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.
447 448 449 |
# File 'lib/traim.rb', line 447 def initialize(block) instance_eval(&block) end |
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
455 456 457 |
# File 'lib/traim.rb', line 455 def fields @fields end |
#model ⇒ Object
Returns the value of attribute model.
454 455 456 |
# File 'lib/traim.rb', line 454 def model @model end |
#request ⇒ Object
Returns the value of attribute request.
452 453 454 |
# File 'lib/traim.rb', line 452 def request @request end |
#status ⇒ Object
Returns the value of attribute status.
453 454 455 |
# File 'lib/traim.rb', line 453 def status @status end |
Instance Method Details
#attribute(name, &block) ⇒ Object
458 459 460 |
# File 'lib/traim.rb', line 458 def attribute(name, &block) fields << {name: name, type: 'attribute', block: block} end |
#has_many(name, options = {}, &block) ⇒ Object
461 462 463 |
# File 'lib/traim.rb', line 461 def has_many(name, ={}, &block) fields << {name: name, type: 'association', resource: [:resource], block: block} end |
#has_one(name, options = {}, &block) ⇒ Object
464 465 466 |
# File 'lib/traim.rb', line 464 def has_one(name, ={}, &block) fields << {name: name, type: 'connection', resource: [:resource], block: block} end |
#logger ⇒ Object
450 |
# File 'lib/traim.rb', line 450 def logger; Traim.logger end |