Class: Printfection::Relation
- Inherits:
-
Object
- Object
- Printfection::Relation
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/printfection/relation.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Relation
constructor
A new instance of Relation.
- #new(*args) ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Relation
Returns a new instance of Relation.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/printfection/relation.rb', line 9 def initialize(={}) = { parent: nil, children: [], klass: Hashie::Mash, path: "", keys: {}, actions: [] }.merge() @parent = .fetch(:parent) @children = .fetch(:children) @klass = .fetch(:klass) @path = .fetch(:path) @keys = .fetch(:keys) @actions = .fetch(:actions) actions.each do |mod| self.extend(mod) end children.each do |child| apply_relation(child) end end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
7 8 9 |
# File 'lib/printfection/relation.rb', line 7 def actions @actions end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
7 8 9 |
# File 'lib/printfection/relation.rb', line 7 def children @children end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
7 8 9 |
# File 'lib/printfection/relation.rb', line 7 def keys @keys end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
7 8 9 |
# File 'lib/printfection/relation.rb', line 7 def klass @klass end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
7 8 9 |
# File 'lib/printfection/relation.rb', line 7 def parent @parent end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/printfection/relation.rb', line 7 def path @path end |