Module: Excom::Plugins::Args
- Defined in:
- lib/excom/plugins/args.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #initialize(*args) ⇒ Object
- #initialize_clone ⇒ Object
- #with_args(*args) ⇒ Object
- #with_opts(opts) ⇒ Object
Instance Method Details
#initialize(*args) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/excom/plugins/args.rb', line 5 def initialize(*args) args, opts = resolve_args!(args) assert_valid_args!(args) assert_valid_opts!(opts) @args = args @opts = opts end |
#initialize_clone ⇒ Object
15 16 17 18 19 |
# File 'lib/excom/plugins/args.rb', line 15 def initialize_clone(*) super @args = @args.dup @opts = @opts.dup end |
#with_args(*args) ⇒ Object
21 22 23 |
# File 'lib/excom/plugins/args.rb', line 21 def with_args(*args) clone.tap{ |copy| copy.args.replace(args) } end |
#with_opts(opts) ⇒ Object
25 26 27 |
# File 'lib/excom/plugins/args.rb', line 25 def with_opts(opts) clone.tap{ |copy| copy.opts.merge!(opts) } end |