Class: Klases::Argset
- Inherits:
-
Object
- Object
- Klases::Argset
- Defined in:
- lib/klases/argset.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #args_and_options ⇒ Object
- #before(*args) ⇒ Object
- #before!(*args) ⇒ Object
- #block(block = false) ⇒ Object
- #block!(block) ⇒ Object
-
#initialize(*args, &block) ⇒ Argset
constructor
A new instance of Argset.
- #send_to(receiver, method) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(*args, &block) ⇒ Argset
5 6 7 8 9 |
# File 'lib/klases/argset.rb', line 5 def initialize(*args, &block) = args. @args = args @block = block end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
11 12 13 |
# File 'lib/klases/argset.rb', line 11 def args @args end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/klases/argset.rb', line 11 def end |
Instance Method Details
#[](index) ⇒ Object
13 14 15 |
# File 'lib/klases/argset.rb', line 13 def [](index) args[index] end |
#args_and_options ⇒ Object
36 37 38 |
# File 'lib/klases/argset.rb', line 36 def ? [*@args, ] : @args end |
#before(*args) ⇒ Object
27 28 29 |
# File 'lib/klases/argset.rb', line 27 def before(*args) self.dup.before!(*args) end |
#before!(*args) ⇒ Object
31 32 33 34 |
# File 'lib/klases/argset.rb', line 31 def before!(*args) @args = args + @args self end |
#block(block = false) ⇒ Object
17 18 19 20 |
# File 'lib/klases/argset.rb', line 17 def block(block = false) return @block if block == false self.dup.block!(block) end |
#block!(block) ⇒ Object
22 23 24 25 |
# File 'lib/klases/argset.rb', line 22 def block!(block) @block = block self end |
#send_to(receiver, method) ⇒ Object
40 41 42 |
# File 'lib/klases/argset.rb', line 40 def send_to(receiver, method) receiver.__send__(method, *, &@block) end |
#size ⇒ Object
44 45 46 |
# File 'lib/klases/argset.rb', line 44 def size args.size end |