Class: Code::Object::Code
- Inherits:
-
Code::Object
- Object
- Code::Object
- Code::Object::Code
- Defined in:
- lib/code/object/code.rb
Constant Summary
Constants inherited from Code::Object
Instance Attribute Summary
Attributes included from Concerns::Shared
Class Method Summary collapse
Instance Method Summary collapse
- #code_evaluate ⇒ Object
-
#initialize(*args, **_kargs, &_block) ⇒ Code
constructor
A new instance of Code.
Methods inherited from Code::Object
code_new, #code_new, maybe, #name, repeat, |
Methods included from Concerns::Shared
#<=>, #==, #as_json, #call, #code_and, #code_as_json, #code_deep_duplicate, #code_different, #code_duplicate, #code_equal_equal, #code_equal_equal_equal, #code_exclamation_point, #code_exclusive_range, #code_falsy?, code_fetch, #code_fetch, #code_get, code_get, #code_inclusive_range, #code_inspect, #code_methods, #code_name, #code_or, #code_self, code_set, #code_set, #code_to_boolean, #code_to_class, #code_to_date, #code_to_decimal, #code_to_dictionary, #code_to_duration, #code_to_integer, #code_to_json, #code_to_list, #code_to_nothing, #code_to_parameter, #code_to_range, #code_to_string, #code_to_time, #code_truthy?, #eql?, #falsy?, #hash, #inspect, #multi_fetch, #nothing?, #sig, #succ, #to_code, #to_json, #to_s, #truthy?
Constructor Details
#initialize(*args, **_kargs, &_block) ⇒ Code
Returns a new instance of Code.
6 7 8 9 10 11 12 13 |
# File 'lib/code/object/code.rb', line 6 def initialize(*args, **_kargs, &_block) self.raw = if args.first.is_a?(Node) args.first else Node::Code.new(::Code.parse(args.first.to_s)) end end |
Class Method Details
.code_evaluate(*args, **globals) ⇒ Object
15 16 17 18 19 |
# File 'lib/code/object/code.rb', line 15 def self.code_evaluate(*args, **globals) code_args = args.to_code new(*code_args.raw).code_evaluate(**globals) end |
Instance Method Details
#code_evaluate ⇒ Object
21 22 23 |
# File 'lib/code/object/code.rb', line 21 def code_evaluate(...) raw.evaluate(...) end |