Class: Code::Object::IdentifierList
- Inherits:
-
List
- Object
- Code::Object
- List
- Code::Object::IdentifierList
- Defined in:
- lib/code/object/identifier_list.rb
Instance Attribute Summary
Attributes inherited from Code::Object
Instance Method Summary collapse
Methods inherited from List
#code_any?, #code_append, #code_detect, #code_each, #code_first, #code_flatten, #code_include?, #code_join, #code_last, #code_map, #code_map!, #code_max, #code_max_by, #code_none?, #code_reduce, #code_reject, #code_reject!, #code_reverse, #code_select, #code_select!, #code_size, #code_sort, #code_sum, #code_uniq, #initialize
Methods inherited from Code::Object
#<=>, #==, #as_json, as_json, call, #code_and_operator, code_and_operator, code_as_json, #code_as_json, #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_json, code_to_json, falsy?, #falsy?, #hash, #initialize, inspect, maybe, #multi_fetch, multi_fetch, nothing?, #nothing?, repeat, sig, #sig, #succ, to_json, #to_json, to_s, truthy?, #truthy?, |
Constructor Details
This class inherits a constructor from Code::Object::List
Instance Method Details
#call(**args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/code/object/identifier_list.rb', line 6 def call(**args) operator = args.fetch(:operator, nil) arguments = args.fetch(:arguments, List.new) context = args.fetch(:context) value = arguments.code_first case operator.to_s when /=$/ sig(args) { Object } context = context.lookup!(raw.first) context = raw[..-2].reduce(context) do |context, identifier| context.code_fetch(identifier) end context.code_set( raw.last, if operator == "=" value else context.fetch(raw.last).call( **args, operator: operator.chop, arguments: List.new([value]) ) end ) context.code_fetch(raw.last) else super end end |