Module: Excom::Plugins::Args

Defined in:
lib/excom/plugins/args.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#initialize(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# 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

  super()
end

#initialize_cloneObject



17
18
19
20
21
# File 'lib/excom/plugins/args.rb', line 17

def initialize_clone(*)
  super
  @args = @args.dup unless @args.nil?
  @opts = @opts.dup unless @opts.nil?
end

#with_args(*args) ⇒ Object



23
24
25
# File 'lib/excom/plugins/args.rb', line 23

def with_args(*args)
  clone.tap{ |copy| copy.args.replace(args) }
end

#with_opts(opts) ⇒ Object



27
28
29
# File 'lib/excom/plugins/args.rb', line 27

def with_opts(opts)
  clone.tap{ |copy| copy.opts.merge!(opts) }
end