class Convergence::DSL
Attributes
current_dir_path[RW]
tables[RW]
Public Class Methods
new()
click to toggle source
# File lib/convergence/dsl.rb, line 6 def initialize @tables = {} end
parse(code, current_dir_path)
click to toggle source
# File lib/convergence/dsl.rb, line 22 def self.parse(code, current_dir_path) parser = new parser.current_dir_path = current_dir_path parser.instance_eval(code) parser.tables end
Public Instance Methods
create_table(table_name, options = {}, &block)
click to toggle source
# File lib/convergence/dsl.rb, line 10 def create_table(table_name, options = {}, &block) table = Convergence::Table.new(table_name.to_s, options) block.call(table) @tables[table_name.to_s] = table table end
include(path)
click to toggle source
# File lib/convergence/dsl.rb, line 17 def include(path) next_dir_path = File.dirname("#{@current_dir_path}/#{path}") @tables.merge!(Convergence::DSL.parse(File.open("#{current_dir_path}/#{path}").read, next_dir_path)) end