Class: InOrder::Aux::Keys
- Inherits:
-
Object
- Object
- InOrder::Aux::Keys
- Defined in:
- app/models/in_order/aux/keys.rb
Instance Attribute Summary collapse
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #call(**extras) ⇒ Object
-
#initialize(_owner = nil, _scope = nil, owner: _owner, scope: _scope) ⇒ Keys
constructor
A new instance of Keys.
- #owner_key ⇒ Object
- #owner_params ⇒ Object
- #scope_params ⇒ Object
- #to_a ⇒ Object
- #to_h ⇒ Object (also: #to_params)
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(_owner = nil, _scope = nil, owner: _owner, scope: _scope) ⇒ Keys
Returns a new instance of Keys.
7 8 9 10 11 |
# File 'app/models/in_order/aux/keys.rb', line 7 def initialize(_owner=nil, _scope=nil, owner: _owner, scope: _scope) self.owner = owner self.scope = scope end |
Instance Attribute Details
#owner ⇒ Object
Returns the value of attribute owner.
5 6 7 |
# File 'app/models/in_order/aux/keys.rb', line 5 def owner @owner end |
#scope ⇒ Object
Returns the value of attribute scope.
5 6 7 |
# File 'app/models/in_order/aux/keys.rb', line 5 def scope @scope end |
Instance Method Details
#==(other) ⇒ Object
46 47 48 |
# File 'app/models/in_order/aux/keys.rb', line 46 def ==(other) to_a == other.to_a end |
#call(**extras) ⇒ Object
13 14 15 |
# File 'app/models/in_order/aux/keys.rb', line 13 def call(**extras) to_params.merge extras end |
#owner_key ⇒ Object
42 43 44 |
# File 'app/models/in_order/aux/keys.rb', line 42 def owner_key InOrder::Aux::PolyKey.new(owner, default_name: 'owner') end |
#owner_params ⇒ Object
34 35 36 |
# File 'app/models/in_order/aux/keys.rb', line 34 def owner_params owner_key.to_params end |
#scope_params ⇒ Object
38 39 40 |
# File 'app/models/in_order/aux/keys.rb', line 38 def scope_params { scope: scope } end |
#to_a ⇒ Object
30 31 32 |
# File 'app/models/in_order/aux/keys.rb', line 30 def to_a [ owner, scope ] end |
#to_h ⇒ Object Also known as: to_params
21 22 23 |
# File 'app/models/in_order/aux/keys.rb', line 21 def to_h owner_params.merge scope_params end |
#to_s ⇒ Object
26 27 28 |
# File 'app/models/in_order/aux/keys.rb', line 26 def to_s to_a.compact.map(&:to_s) * ', ' end |
#valid? ⇒ Boolean
17 18 19 |
# File 'app/models/in_order/aux/keys.rb', line 17 def valid? to_a.any? end |