Class: Lisp::Format::Parameters::Argument
- Defined in:
- lib/carat/lisp-format.rb
Overview
Represents the V and v parameters, which retrieve their value from the current argument.
Instance Attribute Summary
Attributes inherited from Parameter
Instance Method Summary collapse
-
#value(state, default) ⇒ Object
Retrieve this parameters value by getting the value of the current arguments integral value.
Methods inherited from Parameter
Constructor Details
This class inherits a constructor from Lisp::Format::Parameters::Parameter
Instance Method Details
#value(state, default) ⇒ Object
Retrieve this parameters value by getting the value of the current arguments integral value.
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/carat/lisp-format.rb', line 451 def value(state, default) begin arg = state.next_arg rescue => e e.pos = @pos if e.respond_to?(:pos) and e.pos == -1 raise end if arg.nil? default elsif arg.respond_to? :to_i arg.to_i else raise ArgumentError.new(@pos), 'argument not a number or a number string' end end |