Class: Traim::Helper
- Inherits:
-
Object
- Object
- Traim::Helper
- Defined in:
- lib/traim.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#model ⇒ Object
Returns the value of attribute model.
-
#request ⇒ Object
Returns the value of attribute request.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #attribute(name, &block) ⇒ Object
- #has_many(name, options = {}, &block) ⇒ Object
- #has_one(name, options = {}, &block) ⇒ Object
-
#initialize(block) ⇒ Helper
constructor
A new instance of Helper.
- #logger ⇒ Object
Constructor Details
#initialize(block) ⇒ Helper
Returns a new instance of Helper.
448 449 450 |
# File 'lib/traim.rb', line 448 def initialize(block) instance_eval(&block) end |
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
456 457 458 |
# File 'lib/traim.rb', line 456 def fields @fields end |
#model ⇒ Object
Returns the value of attribute model.
455 456 457 |
# File 'lib/traim.rb', line 455 def model @model end |
#request ⇒ Object
Returns the value of attribute request.
453 454 455 |
# File 'lib/traim.rb', line 453 def request @request end |
#status ⇒ Object
Returns the value of attribute status.
454 455 456 |
# File 'lib/traim.rb', line 454 def status @status end |
Instance Method Details
#attribute(name, &block) ⇒ Object
459 460 461 |
# File 'lib/traim.rb', line 459 def attribute(name, &block) fields << {name: name, type: 'attribute', block: block} end |
#has_many(name, options = {}, &block) ⇒ Object
462 463 464 |
# File 'lib/traim.rb', line 462 def has_many(name, ={}, &block) fields << {name: name, type: 'association', resource: [:resource], block: block} end |
#has_one(name, options = {}, &block) ⇒ Object
465 466 467 |
# File 'lib/traim.rb', line 465 def has_one(name, ={}, &block) fields << {name: name, type: 'connection', resource: [:resource], block: block} end |
#logger ⇒ Object
451 |
# File 'lib/traim.rb', line 451 def logger; Traim.logger end |