Class: Speq::Arguments
- Inherits:
-
Object
- Object
- Speq::Arguments
- Defined in:
- lib/speq/values.rb,
lib/speq/string_fmt.rb
Overview
Holds arguments to be passed to something later
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
-
#initialize(*args, &block) ⇒ Arguments
constructor
A new instance of Arguments.
- #to_s ⇒ Object
Constructor Details
#initialize(*args, &block) ⇒ Arguments
Returns a new instance of Arguments.
63 64 65 66 |
# File 'lib/speq/values.rb', line 63 def initialize(*args, &block) @args = args @block = block if block_given? end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
62 63 64 |
# File 'lib/speq/values.rb', line 62 def args @args end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
62 63 64 |
# File 'lib/speq/values.rb', line 62 def block @block end |
Instance Method Details
#to_s ⇒ Object
64 65 66 67 68 69 |
# File 'lib/speq/string_fmt.rb', line 64 def to_s arg_str = args.map(&:inspect).join(', ') sep = args.empty? && block ? '' : ', ' block_str = block ? "#{sep}&{ ... }" : '' "#{arg_str}#{block_str}" end |