Class: Ruby::Node
- Inherits:
-
Object
- Object
- Ruby::Node
- Includes:
- Traversal::Misc, Traversal::Module, Traversal::Patch, RubyAPI, RubyAPI::Mutator
- Defined in:
- lib/mutate/api.rb,
lib/traversal/misc.rb,
lib/traversal/mixin.rb,
lib/traversal/patch.rb,
lib/traversal/module.rb,
lib/traversal/api/traversal.rb
Defined Under Namespace
Modules: Traversal
Instance Method Summary collapse
- #has_block? ⇒ Boolean
- #has_const?(value) ⇒ Boolean
- #has_identifier?(value) ⇒ Boolean
- #has_namespace?(value) ⇒ Boolean
Methods included from RubyAPI::Inside
#inside_block, #inside_class, #inside_def, #inside_module
Methods included from RubyAPI::Finders
#find_assignment, #find_block, #find_call, #find_class, #find_def, #find_module, #find_variable
Methods included from Traversal::Patch
#check_pair, #children, #matches?, #select
Methods included from Traversal::Misc
#args?, #argument_count, #convert_value, #get_arg, #get_args_list, #get_array, #get_assoc, #get_composite, #get_hash, #get_hash_item, #get_identifier, #get_key, #get_string, #get_symbol, #get_token, #get_value, #has_a_block?, #resolve_arg_wrapper, #retrieve_arg, #valid_arg?
Methods included from Traversal::Module
#class_or_module?, #get_full_namespace, #get_namespace, #module_namespace?, #namespace?, #superclass?
Methods included from RubyAPI::Mutator
#append_code, #append_code_simple, #append_comment, #elemental?, #find_index, #get_elements, #prepend_code
Methods included from RubyAPI::Mutator::Replacer
Methods included from ValueReplacer
Methods included from HashReplacer
#hash_arg?, #matching_hash_arg?, #matching_symbol_arg?, #replace_hash_arg, #set_ldelim
Methods included from TokenReplacer
#matching_string_arg?, #replace_arg_token
Methods included from PositionReplacer
#position_arg?, #replace_pos_argument, #replace_position_arg
Instance Method Details
#has_block? ⇒ Boolean
21 22 23 |
# File 'lib/traversal/mixin.rb', line 21 def has_block? respond_to? :block end |
#has_const?(value) ⇒ Boolean
11 12 13 14 15 16 17 18 19 |
# File 'lib/traversal/mixin.rb', line 11 def has_const?(value) if respond_to?(:const) if namespace?(value) name = value.split('::').last return self.const.identifier.token == name end end false end |
#has_identifier?(value) ⇒ Boolean
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/traversal/mixin.rb', line 32 def has_identifier?(value) if respond_to?(:identifier) id = self.identifier if namespace?(value) return id.token.to_s == value.to_s if id.respond_to?(:token) if id.respond_to?(:identifier) name = value.split('::').last return id.identifier.token == name end end else has_const?(value) end end |
#has_namespace?(value) ⇒ Boolean
25 26 27 28 29 30 |
# File 'lib/traversal/mixin.rb', line 25 def has_namespace?(value) if respond_to?(:namespace) return self.namespace.identifier.token == value end false end |