Module: RubyAPI::Mutator::Replacer
- Includes:
- HashReplacer, PositionReplacer, TokenReplacer, ValueReplacer
- Included in:
- RubyAPI::Mutator
- Defined in:
- lib/mutate/replacer.rb
Instance Method Summary collapse
-
#replace(options) ⇒ Object
:arg => ‘ripper’, :replace_arg => ‘rapper’.
- #replace_argument(options) ⇒ Object
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
#replace(options) ⇒ Object
:arg => ‘ripper’, :replace_arg => ‘rapper’
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/mutate/replacer.rb', line 100 def replace() if [:value] return replace_value() end if position_arg?([:arg]) return replace_position_arg() end self.arguments.elements.each_with_index do |elem, i| case elem when Ruby::Arg if elem.hash_arg?([:arg]) return elem.replace_hash_arg() end elem.replace_argument() end end end |
#replace_argument(options) ⇒ Object
120 121 122 123 124 125 |
# File 'lib/mutate/replacer.rb', line 120 def replace_argument() case self.arg when Ruby::String replace_arg_token([:replace_arg]) if matching_string_arg?([:arg]) end end |