@@ -5,96 +5,96 @@ module Concerns
55 module Shared
66 attr_accessor :raw , :functions
77
8- COMPOUND_ASSIGNMENT_OPERATORS = [
9- "+=" ,
10- "-=" ,
11- "*=" ,
12- "/=" ,
13- "%=" ,
14- " <<=" ,
15- " >>=" ,
16- "&=" ,
17- "|=" ,
18- "^=" ,
19- " ||=" ,
20- " &&="
8+ COMPOUND_ASSIGNMENT_OPERATORS = %w [
9+ +=
10+ -=
11+ *=
12+ /=
13+ %=
14+ <<=
15+ >>=
16+ &=
17+ |=
18+ ^=
19+ ||=
20+ &&=
2121 ] . freeze
22- SHARED_OPERATORS = [
23- " documentation" ,
24- " present?" ,
25- " blank?" ,
26- " presence" ,
27- " presence_in" ,
28- " is_a?" ,
29- " is_an?" ,
30- " kind_of?" ,
31- " instance_of?" ,
32- " new" ,
33- "!" ,
34- " not" ,
35- "!=" ,
36- " different" ,
37- "&&" ,
38- " and" ,
39- "+" ,
40- " self" ,
41- ".." ,
42- " inclusive_range" ,
43- " ..." ,
44- " exclusive_range" ,
45- "==" ,
46- " equal" ,
47- " equal?" ,
48- " same_object?" ,
49- ">" ,
50- " greater" ,
51- ">=" ,
52- " greater_or_equal" ,
53- " <=>" ,
54- " compare" ,
55- "<" ,
56- " less" ,
57- "<=" ,
58- " less_or_equal" ,
59- " ===" ,
60- " strict_equal" ,
61- " !==" ,
62- " strict_different" ,
63- " falsy?" ,
64- " truthy?" ,
65- " true?" ,
66- " false?" ,
67- "||" ,
68- "or" ,
69- " to_boolean" ,
70- " to_class" ,
71- " to_date" ,
72- " to_decimal" ,
73- " to_dictionary" ,
74- " to_duration" ,
75- " to_integer" ,
76- " to_list" ,
77- " to_nothing" ,
78- " to_range" ,
79- " to_string" ,
80- " inspect" ,
81- " to_time" ,
82- " as_json" ,
83- " duplicate" ,
84- " deep_duplicate" ,
85- " to_parameter" ,
86- " to_json" ,
87- " functions" ,
88- " instance_functions" ,
89- " class_functions" ,
90- " respond_to?" ,
91- " send" ,
92- " itself" ,
93- " tap" ,
94- " then" ,
95- " name" ,
96- " nothing?" ,
97- " something?"
22+ SHARED_OPERATORS = %w [
23+ documentation
24+ present?
25+ blank?
26+ presence
27+ presence_in
28+ is_a?
29+ is_an?
30+ kind_of?
31+ instance_of?
32+ new
33+ !
34+ not
35+ !=
36+ different
37+ &&
38+ and
39+ +
40+ self
41+ ..
42+ inclusive_range
43+ ...
44+ exclusive_range
45+ ==
46+ equal
47+ equal?
48+ same_object?
49+ >
50+ greater
51+ >=
52+ greater_or_equal
53+ <=>
54+ compare
55+ <
56+ less
57+ <=
58+ less_or_equal
59+ ===
60+ strict_equal
61+ !==
62+ strict_different
63+ falsy?
64+ truthy?
65+ true?
66+ false?
67+ ||
68+ or
69+ to_boolean
70+ to_class
71+ to_date
72+ to_decimal
73+ to_dictionary
74+ to_duration
75+ to_integer
76+ to_list
77+ to_nothing
78+ to_range
79+ to_string
80+ inspect
81+ to_time
82+ as_json
83+ duplicate
84+ deep_duplicate
85+ to_parameter
86+ to_json
87+ functions
88+ instance_functions
89+ class_functions
90+ respond_to?
91+ send
92+ itself
93+ tap
94+ then
95+ name
96+ nothing?
97+ something?
9898 ] . freeze
9999 OPERATOR_METHOD_ALIASES = {
100100 "[]" => "get" ,
@@ -519,7 +519,9 @@ def code_dynamic_call(operator, **args)
519519 return nil unless code_dynamic_functions . code_has_key? ( operator ) . truthy?
520520
521521 stored_value = code_dynamic_functions . code_fetch ( operator )
522- return stored_value . call ( **args , operator : nil , bound_self : self ) if stored_value . is_a? ( Object ::Function )
522+ if stored_value . is_a? ( Object ::Function )
523+ return stored_value . call ( **args , operator : nil , bound_self : self )
524+ end
523525
524526 sig ( args )
525527 stored_value
@@ -641,9 +643,10 @@ def code_functions
641643
642644 def code_instance_functions
643645 Object . sorted_dictionary (
644- Object . documented_functions_for ( self . class , :instance ) . code_merge (
645- dynamic_functions_documentation
646- ) . raw
646+ Object
647+ . documented_functions_for ( self . class , :instance )
648+ . code_merge ( dynamic_functions_documentation )
649+ . raw
647650 )
648651 end
649652
@@ -755,7 +758,8 @@ def code_respond_to_operator?(operator)
755758 end
756759
757760 def code_operator_method_defined? ( operator_name )
758- method_name = :"code_#{ OPERATOR_METHOD_ALIASES . fetch ( operator_name , operator_name ) } "
761+ method_name =
762+ :"code_#{ OPERATOR_METHOD_ALIASES . fetch ( operator_name , operator_name ) } "
759763 return false unless respond_to? ( method_name )
760764
761765 method ( method_name ) . owner != Shared
@@ -775,10 +779,10 @@ def dynamic_functions_documentation
775779 name ,
776780 Object ::Dictionary . new (
777781 "name" => Object ::String . new ( name ) ,
778- "description" => Object :: String . new (
779- dynamic_function_description ( value )
780- ) ,
781- "examples" => Object ::List . new ( dynamic_function_examples ( value ) ) ,
782+ "description" =>
783+ Object :: String . new ( dynamic_function_description ( value ) ) ,
784+ "examples" =>
785+ Object ::List . new ( dynamic_function_examples ( value ) ) ,
782786 "function" => value
783787 )
784788 ]
0 commit comments