Class: Chemtrail::Function
- Inherits:
-
Object
- Object
- Chemtrail::Function
- Defined in:
- lib/chemtrail/function.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #argument_list ⇒ Object
-
#initialize(name, *arguments) ⇒ Function
constructor
A new instance of Function.
- #to_hash ⇒ Object
Constructor Details
#initialize(name, *arguments) ⇒ Function
Returns a new instance of Function.
4 5 6 7 |
# File 'lib/chemtrail/function.rb', line 4 def initialize(name, *arguments) @name = name @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
2 3 4 |
# File 'lib/chemtrail/function.rb', line 2 def arguments @arguments end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/chemtrail/function.rb', line 2 def name @name end |
Instance Method Details
#argument_list ⇒ Object
9 10 11 12 13 |
# File 'lib/chemtrail/function.rb', line 9 def argument_list @argument_list ||= arguments.map do |argument| Chemtrail::ReferencePresenter.new(argument).to_parameter end end |
#to_hash ⇒ Object
15 16 17 18 19 |
# File 'lib/chemtrail/function.rb', line 15 def to_hash { name => argument_list.count > 1 ? argument_list : argument_list.first || "" } end |