Class: Code::Object::IdentifierList

Inherits:
List show all
Defined in:
lib/code/object/identifier_list.rb

Constant Summary collapse

CLASS_DOCUMENTATION =
{
  name: "IdentifierList",
  description:
    "stores ordered identifier names used to assign nested values.",
  examples: [
    "IdentifierList",
    "IdentifierList.new([:user, :name]).first",
    "IdentifierList.new([:user, :name]).join(\".\")"
  ]
}.freeze

Constants inherited from List

List::INSTANCE_FUNCTIONS

Constants inherited from Code::Object

CLASS_FUNCTIONS, INSTANCE_FUNCTIONS, NUMBER_CLASSES

Constants included from Concerns::Shared

Concerns::Shared::COMPOUND_ASSIGNMENT_OPERATORS, Concerns::Shared::OPERATOR_METHOD_ALIASES, Concerns::Shared::SHARED_OPERATORS

Instance Attribute Summary

Attributes included from Concerns::Shared

#functions, #raw

Instance Method Summary collapse

Methods inherited from List

#any?, #code_all?, #code_any?, #code_append, #code_associate, #code_clear, #code_combination, #code_compact, #code_compact!, #code_concat, #code_count, #code_cycle, #code_deep_duplicate, #code_delete, #code_delete_at, #code_delete_if, #code_detect, #code_difference, #code_drop, #code_drop_while, #code_each, #code_each_index, #code_eighteenth, #code_eighth, #code_eightieth, #code_eighty_eighth, #code_eighty_fifth, #code_eighty_first, #code_eighty_fourth, #code_eighty_ninth, #code_eighty_second, #code_eighty_seventh, #code_eighty_sixth, #code_eighty_third, #code_eleventh, #code_empty?, #code_entries, #code_fetch, #code_fifteenth, #code_fifth, #code_fiftieth, #code_fifty_eighth, #code_fifty_fifth, #code_fifty_first, #code_fifty_fourth, #code_fifty_ninth, #code_fifty_second, #code_fifty_seventh, #code_fifty_sixth, #code_fifty_third, #code_fill, #code_first, #code_flat_map, #code_flatten, #code_fortieth, #code_forty_eighth, #code_forty_fifth, #code_forty_first, #code_forty_fourth, #code_forty_ninth, #code_forty_second, #code_forty_seventh, #code_forty_sixth, #code_forty_third, #code_fourteenth, #code_fourth, #code_get, #code_group, #code_include?, #code_index, #code_insert, #code_intersect?, #code_intersection, #code_join, #code_keep_if, #code_last, #code_map, #code_map!, #code_max, #code_maximum, #code_minimum, #code_minimum_maximum, #code_minus, #code_nineteenth, #code_ninetieth, #code_ninety_eighth, #code_ninety_fifth, #code_ninety_first, #code_ninety_fourth, #code_ninety_ninth, #code_ninety_second, #code_ninety_seventh, #code_ninety_sixth, #code_ninety_third, #code_ninth, #code_none?, #code_nth, #code_one_hundredth, #code_partition, #code_permutation, #code_plus, #code_pop, #code_pop!, #code_prepend, #code_product, #code_push, #code_reduce, #code_reject, #code_reject!, #code_repeated_combination, #code_repeated_permutation, #code_reverse, #code_reverse!, #code_reverse_each, #code_right_associate, #code_right_index, #code_rotate, #code_rotate!, #code_sample, #code_second, #code_select, #code_select!, #code_set, #code_seventeenth, #code_seventh, #code_seventieth, #code_seventy_eighth, #code_seventy_fifth, #code_seventy_first, #code_seventy_fourth, #code_seventy_ninth, #code_seventy_second, #code_seventy_seventh, #code_seventy_sixth, #code_seventy_third, #code_shift, #code_shuffle, #code_shuffle!, #code_sixteenth, #code_sixth, #code_sixtieth, #code_sixty_eighth, #code_sixty_fifth, #code_sixty_first, #code_sixty_fourth, #code_sixty_ninth, #code_sixty_second, #code_sixty_seventh, #code_sixty_sixth, #code_sixty_third, #code_size, #code_slice, #code_slice!, #code_sort, #code_sort!, #code_sort_by!, #code_sum, #code_take, #code_take_while, #code_tally, #code_tenth, #code_third, #code_thirteenth, #code_thirtieth, #code_thirty_eighth, #code_thirty_fifth, #code_thirty_first, #code_thirty_fourth, #code_thirty_ninth, #code_thirty_second, #code_thirty_seventh, #code_thirty_sixth, #code_thirty_third, #code_to_dictionary, #code_transpose, #code_twelfth, #code_twentieth, #code_twenty_eighth, #code_twenty_fifth, #code_twenty_first, #code_twenty_fourth, #code_twenty_ninth, #code_twenty_second, #code_twenty_seventh, #code_twenty_sixth, #code_twenty_third, #code_union, #code_uniq, #code_uniq!, #code_values_at, #code_zip, function_documentation, #initialize, #present?

Methods inherited from Code::Object

class_documentation, class_functions, code_new, #code_new, documentation, documentation_for, documented_functions_for, function_documentation, function_documentation_for, function_documentation_registry_for, functions, inherited_function_documentation_for, #initialize, instance_functions, maybe, #name, repeat, sorted_dictionary, |

Methods included from Concerns::Shared

#<=>, #==, #as_json, #blank?, #code_and, #code_as_json, #code_blank?, #code_class_functions, #code_compare, #code_deep_duplicate, #code_different, #code_documentable_functions, #code_documentation, #code_duplicate, #code_dynamic_call, #code_equal, #code_exclamation_mark, #code_exclusive_range, #code_false?, #code_falsy?, code_fetch, #code_fetch, #code_functions, code_get, #code_get, #code_greater, #code_greater_or_equal, #code_has_key?, #code_inclusive_range, #code_inspect, #code_instance_functions, #code_instance_of?, #code_is_a?, #code_itself, #code_less, #code_less_or_equal, #code_name, #code_nothing?, #code_or, #code_presence, #code_presence_in, #code_present?, #code_respond_to?, #code_same_object?, #code_self, #code_send, code_set, #code_set, #code_something?, #code_strict_different, #code_strict_equal, #code_tap, #code_then, #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_true?, #code_truthy?, #eql?, #falsy?, #hash, #inspect, #multi_fetch, #nothing?, #present?, #sig, #something?, #succ, #to_code, #to_i, #to_json, #to_s, #truthy?

Constructor Details

This class inherits a constructor from Code::Object::List

Instance Method Details

#call(**args) ⇒ Object



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
41
42
43
44
45
# File 'lib/code/object/identifier_list.rb', line 16

def call(**args)
  code_operator = args.fetch(:operator, nil).to_code
  code_arguments = args.fetch(:arguments, []).to_code
  code_context = args.fetch(:context).to_code
  code_value = code_arguments.code_first

  case code_operator.to_s
  when /=$/
    sig(args) { Object }
    assignment_operator = code_operator.to_s
    context = find_context_with_identifier(code_context, raw.first)

    if context
      assign_in_context(
        context: context,
        assignment_operator: assignment_operator,
        code_value: code_value,
        **args.except(:context)
      )
    else
      assign_with_setter(
        assignment_operator: assignment_operator,
        code_value: code_value,
        **args
      )
    end
  else
    super
  end
end