Class: Riptables::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/riptables/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/riptables/base.rb', line 9

def initialize(&block)
  @tables = []
  dsl.instance_eval(&block) if block_given?
end

Instance Attribute Details

#tablesObject (readonly)

Returns the value of attribute tables.



7
8
9
# File 'lib/riptables/base.rb', line 7

def tables
  @tables
end

Class Method Details

.load_from_file(file) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/riptables/base.rb', line 18

def self.load_from_file(file)
  if File.file?(file)
    base = Base.new
    base.dsl.instance_eval(File.read(file), file)
    base
  else
    raise Error, "File not found at `#{file}`"
  end
end

Instance Method Details

#dslObject



14
15
16
# File 'lib/riptables/base.rb', line 14

def dsl
  @dsl ||= DSL::Base.new(self)
end