class ReverseParameters::Arguments::Arg

Public Instance Methods

block_as_value() click to toggle source
# File lib/reverse_parameters.rb, line 105
def block_as_value
  case state
  when :key, :keyreq
    "#{name}: #{name}"
  else
    name
  end.to_s
end
to_s() click to toggle source
# File lib/reverse_parameters.rb, line 90
def to_s
  case state
  when :key, :keyreq
    "#{name}: #{name}"
  when :keyrest
    "**#{name}"
  when :rest
    "*#{name}"
  when :block
    block(name)
  else
    name
  end.to_s
end

Private Instance Methods

block(name) click to toggle source
# File lib/reverse_parameters.rb, line 120
def block(name)
  if @blocks_as_values
    name
  else
    "&#{name}"
  end
end
post_initialize(blocks_as_values:) click to toggle source
# File lib/reverse_parameters.rb, line 116
def post_initialize(blocks_as_values:)
  @blocks_as_values = blocks_as_values
end