Module: PositionReplacer

Included in:
RubyAPI::Mutator::Replacer
Defined in:
lib/mutate/replacer.rb

Instance Method Summary collapse

Instance Method Details

#position_arg?(arg) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/mutate/replacer.rb', line 14

def position_arg?(arg)       
  return arg[1] if arg && arg[0]  == '#'
  nil
end

#replace_pos_argument(options) ⇒ Object



7
8
9
10
11
12
# File 'lib/mutate/replacer.rb', line 7

def replace_pos_argument(options)                                    
  case self.arg
  when Ruby::String                                    
    replace_arg_token(options[:replace_arg])
  end
end

#replace_position_arg(options) ⇒ Object



2
3
4
5
# File 'lib/mutate/replacer.rb', line 2

def replace_position_arg(options)
  pos = position_arg?(options[:arg])
  self.arguments.elements[pos.to_i].replace_pos_argument(options)      
end