Class: Commander::Command::Options

Inherits:
Object
  • Object
show all
Includes:
Blank
Defined in:
lib/murano-cli-commander/command.rb

Overview

Options struct.

Instance Method Summary collapse

Methods included from Blank

included

Constructor Details

#initializeOptions

Returns a new instance of Options.



14
15
16
# File 'lib/murano-cli-commander/command.rb', line 14

def initialize
  @table = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



22
23
24
# File 'lib/murano-cli-commander/command.rb', line 22

def method_missing(meth, *args)
  meth.to_s =~ /=$/ ? @table[meth.to_s.chop.to_sym] = args.first : @table[meth]
end

Instance Method Details

#__hash__Object



18
19
20
# File 'lib/murano-cli-commander/command.rb', line 18

def __hash__
  @table
end

#default(defaults = {}) ⇒ Object



26
27
28
# File 'lib/murano-cli-commander/command.rb', line 26

def default(defaults = {})
  @table = defaults.merge! @table
end

#inspectObject



30
31
32
# File 'lib/murano-cli-commander/command.rb', line 30

def inspect
  "<Commander::Command::Options #{ __hash__.map { |k, v| "#{k}=#{v.inspect}" }.join(', ') }>"
end