Class: Artester::Base
- Inherits:
-
Object
- Object
- Artester::Base
- Defined in:
- lib/artester/base.rb
Instance Attribute Summary collapse
-
#models ⇒ Object
Returns the value of attribute models.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Base
constructor
A new instance of Base.
- #model(name, &block) ⇒ Object
- #reload ⇒ Object
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
#models ⇒ Object
Returns the value of attribute models.
3 4 5 |
# File 'lib/artester/base.rb', line 3 def models @models end |
#name ⇒ Object
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 |
#reload ⇒ Object
14 15 16 |
# File 'lib/artester/base.rb', line 14 def reload self.models.each { |name, m| m.reload } end |