Class: FieldMethod
- Inherits:
-
Object
- Object
- FieldMethod
- Defined in:
- lib/flowlink_data/objectbase.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(method_name, *args) ⇒ FieldMethod
constructor
A new instance of FieldMethod.
- #merge(list) ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(method_name, *args) ⇒ FieldMethod
Returns a new instance of FieldMethod.
15 16 17 18 |
# File 'lib/flowlink_data/objectbase.rb', line 15 def initialize(method_name, *args) @method_name = method_name.to_sym @args = args.to_a.flatten end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
2 3 4 |
# File 'lib/flowlink_data/objectbase.rb', line 2 def args @args end |
#method_name ⇒ Object
Returns the value of attribute method_name.
2 3 4 |
# File 'lib/flowlink_data/objectbase.rb', line 2 def method_name @method_name end |
Class Method Details
.merge(overrides, original) ⇒ Object
11 12 13 |
# File 'lib/flowlink_data/objectbase.rb', line 11 def self.merge(overrides, original) overrides.inject(original) { |a, e| e.merge(a) } end |
.multi_new(methods) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/flowlink_data/objectbase.rb', line 4 def self.multi_new(methods) methods.map do |m| m = [m].flatten FieldMethod.new(m.shift, m) end end |
Instance Method Details
#merge(list) ⇒ Object
20 21 22 23 |
# File 'lib/flowlink_data/objectbase.rb', line 20 def merge(list) list.delete_if { |o_fm| o_fm.method_name == method_name } list << self end |
#to_a ⇒ Object
25 26 27 |
# File 'lib/flowlink_data/objectbase.rb', line 25 def to_a [method_name] + args end |