Class: Artester::Base

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Base

Returns a new instance of Base.



4
5
6
7
8
# File 'lib/artester/base.rb', line 4

def initialize(name, &block)
  self.name = name.to_s
  self.models = {}
  instance_eval(&block)
end

Instance Attribute Details

#modelsObject

Returns the value of attribute models.



3
4
5
# File 'lib/artester/base.rb', line 3

def models
  @models
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/artester/base.rb', line 3

def name
  @name
end

Instance Method Details

#model(name, &block) ⇒ Object



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

def model(name, &block)
  self.models[name.to_sym] = Artester::Model.new(name, &block)
end

#reloadObject



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

def reload
  self.models.each { |name, m| m.reload }
end