Class: Code::Object::Parameter
- Inherits:
-
Code::Object
- Object
- Code::Object
- Code::Object::Parameter
- Defined in:
- lib/code/object/parameter.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#keyword_splat ⇒ Object
readonly
Returns the value of attribute keyword_splat.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#regular_splat ⇒ Object
readonly
Returns the value of attribute regular_splat.
Attributes inherited from Code::Object
Class Method Summary collapse
Instance Method Summary collapse
- #evaluate ⇒ Object
-
#initialize(*args, **_kargs, &_block) ⇒ Parameter
constructor
A new instance of Parameter.
- #keyword? ⇒ Boolean
- #keyword_splat? ⇒ Boolean
- #regular? ⇒ Boolean
- #regular_splat? ⇒ Boolean
Methods inherited from Code::Object
#<=>, #==, #as_json, call, #call, #code_and_operator, code_and_operator, code_different, #code_different, code_equal_equal, #code_equal_equal, code_equal_equal_equal, #code_equal_equal_equal, code_exclamation_point, #code_exclamation_point, #code_exclusive_range, code_exclusive_range, code_inclusive_range, #code_inclusive_range, code_new, code_or_operator, #code_or_operator, code_self, #code_self, #code_to_string, code_to_string, falsy?, #falsy?, #hash, inspect, #inspect, maybe, multi_fetch, #multi_fetch, repeat, sig, #sig, #to_json, to_s, #to_s, truthy?, #truthy?, |
Constructor Details
#initialize(*args, **_kargs, &_block) ⇒ Parameter
Returns a new instance of Parameter.
12 13 14 15 16 17 18 19 20 |
# File 'lib/code/object/parameter.rb', line 12 def initialize(*args, **_kargs, &_block) @raw = Dictionary.new(args.first.presence || {}) @name = String.new(@raw.code_get(String.new(:name))) @keyword = Boolean.new(@raw.code_get(String.new(:keyword))) @regular_splat = Boolean.new(@raw.code_get(String.new(:regular_splat))) @keyword_splat = Boolean.new(@raw.code_get(String.new(:keyword_splat))) @default = Code.new(@raw.code_get(String.new(:default))) super end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
6 7 8 |
# File 'lib/code/object/parameter.rb', line 6 def default @default end |
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
6 7 8 |
# File 'lib/code/object/parameter.rb', line 6 def keyword @keyword end |
#keyword_splat ⇒ Object (readonly)
Returns the value of attribute keyword_splat.
6 7 8 |
# File 'lib/code/object/parameter.rb', line 6 def keyword_splat @keyword_splat end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/code/object/parameter.rb', line 6 def name @name end |
#regular_splat ⇒ Object (readonly)
Returns the value of attribute regular_splat.
6 7 8 |
# File 'lib/code/object/parameter.rb', line 6 def regular_splat @regular_splat end |
Class Method Details
.name ⇒ Object
8 9 10 |
# File 'lib/code/object/parameter.rb', line 8 def self.name "Parameter" end |
Instance Method Details
#evaluate ⇒ Object
22 23 24 |
# File 'lib/code/object/parameter.rb', line 22 def evaluate(...) default.evaluate(...) end |
#keyword? ⇒ Boolean
30 31 32 |
# File 'lib/code/object/parameter.rb', line 30 def keyword? keyword.truthy? end |
#keyword_splat? ⇒ Boolean
38 39 40 |
# File 'lib/code/object/parameter.rb', line 38 def keyword_splat? keyword_splat.truthy? end |
#regular? ⇒ Boolean
26 27 28 |
# File 'lib/code/object/parameter.rb', line 26 def regular? !keyword? end |
#regular_splat? ⇒ Boolean
34 35 36 |
# File 'lib/code/object/parameter.rb', line 34 def regular_splat? regular_splat.truthy? end |