Class: Helioth::Relation
- Inherits:
-
Object
- Object
- Helioth::Relation
- Defined in:
- lib/helioth/relation.rb
Instance Method Summary collapse
- #feature(status = nil, &block) ⇒ Object
-
#initialize(&block) ⇒ Relation
constructor
A new instance of Relation.
- #instance(*status) ⇒ Object
- #user(*status) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Relation
Returns a new instance of Relation.
4 5 6 7 |
# File 'lib/helioth/relation.rb', line 4 def initialize(&block) @feature = Hash.new instance_eval(&block) end |
Instance Method Details
#feature(status = nil, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/helioth/relation.rb', line 9 def feature(status = nil, &block) if block.nil? @feature else @@tmp = Hash.new instance_eval(&block) @feature[status] = @@tmp end end |
#instance(*status) ⇒ Object
19 20 21 |
# File 'lib/helioth/relation.rb', line 19 def instance(*status) @@tmp.merge!({instance: status}) end |
#user(*status) ⇒ Object
23 24 25 |
# File 'lib/helioth/relation.rb', line 23 def user(*status) @@tmp.merge!({user: status}) end |