Module: RubyCodeAPI::Manipulation::Update::Position
Defined Under Namespace
Classes: UpdatePositionError
Instance Method Summary
collapse
Instance Method Details
#position_arg?(arg) ⇒ Boolean
22
23
24
25
|
# File 'lib/manipulation/update/position.rb', line 22
def position_arg?(arg)
return arg[1] if arg && arg[0] == '#'
nil
end
|
#replace_pos_argument(options) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/manipulation/update/position.rb', line 13
def replace_pos_argument(options)
case self.arg
when Ruby::String
replace_arg_token(options[:with])
else
raise UpdatePositionError, "Unknown type for replacing positional argument: #{self.arg.class}"
end
end
|
#replace_position_arg(options) ⇒ Object
8
9
10
11
|
# File 'lib/manipulation/update/position.rb', line 8
def replace_position_arg(options)
pos = position_arg?(options[:arg])
self.arguments.elements[pos.to_i].replace_pos_argument(options)
end
|