Class: Code::Object::Argument
- Inherits:
-
Code::Object
- Object
- Code::Object
- Code::Object::Argument
- Defined in:
- lib/code/object/argument.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#keyword_splat ⇒ Object
readonly
Returns the value of attribute keyword_splat.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#splat ⇒ Object
readonly
Returns the value of attribute splat.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, name: nil, splat: false, keyword_splat: false, block: false) ⇒ Argument
constructor
A new instance of Argument.
- #inspect ⇒ Object
- #keyword? ⇒ Boolean
- #name_value ⇒ Object
- #regular? ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from Code::Object
#<=>, #==, #[], #[]=, #call, #falsy?, #hash, #key?, #truthy?
Constructor Details
#initialize(value, name: nil, splat: false, keyword_splat: false, block: false) ⇒ Argument
Returns a new instance of Argument.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/code/object/argument.rb', line 6 def initialize( value, name: nil, splat: false, keyword_splat: false, block: false ) @value = value @name = name @splat = !!splat @keyword_splat = !!keyword_splat @block = !!block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
4 5 6 |
# File 'lib/code/object/argument.rb', line 4 def block @block end |
#keyword_splat ⇒ Object (readonly)
Returns the value of attribute keyword_splat.
4 5 6 |
# File 'lib/code/object/argument.rb', line 4 def keyword_splat @keyword_splat end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/code/object/argument.rb', line 4 def name @name end |
#splat ⇒ Object (readonly)
Returns the value of attribute splat.
4 5 6 |
# File 'lib/code/object/argument.rb', line 4 def splat @splat end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/code/object/argument.rb', line 4 def value @value end |
Instance Method Details
#inspect ⇒ Object
36 37 38 |
# File 'lib/code/object/argument.rb', line 36 def inspect to_s end |
#keyword? ⇒ Boolean
24 25 26 |
# File 'lib/code/object/argument.rb', line 24 def keyword? !regular? end |
#name_value ⇒ Object
28 29 30 |
# File 'lib/code/object/argument.rb', line 28 def name_value [name, value] end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/code/object/argument.rb', line 32 def to_s "argument" end |