Class: Linkage::Configuration::DSL::ComparatorWrapper
- Inherits:
-
Object
- Object
- Linkage::Configuration::DSL::ComparatorWrapper
- Defined in:
- lib/linkage/configuration.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
-
#initialize(dsl, klass, args) ⇒ ComparatorWrapper
constructor
A new instance of ComparatorWrapper.
- #of(*args) ⇒ Object
- #to_comparator(receiver) ⇒ Object
Constructor Details
#initialize(dsl, klass, args) ⇒ ComparatorWrapper
Returns a new instance of ComparatorWrapper.
162 163 164 165 166 |
# File 'lib/linkage/configuration.rb', line 162 def initialize(dsl, klass, args) @dsl = dsl @klass = klass @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
160 161 162 |
# File 'lib/linkage/configuration.rb', line 160 def args @args end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
160 161 162 |
# File 'lib/linkage/configuration.rb', line 160 def klass @klass end |
Instance Method Details
#of(*args) ⇒ Object
168 169 170 171 |
# File 'lib/linkage/configuration.rb', line 168 def of(*args) @args.push(*args) self end |
#to_comparator(receiver) ⇒ Object
173 174 175 176 177 178 |
# File 'lib/linkage/configuration.rb', line 173 def to_comparator(receiver) comparator_args = ([receiver] + @args).collect do |arg| arg.is_a?(DataWrapper) ? arg. : MetaObject.new(arg) end comparator = klass.new(*comparator_args) end |