Class: CommandLine::Switch

Inherits:
Object
  • Object
show all
Defined in:
lib/ejt_command_line.rb

Overview


Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flags, parser = nil) ⇒ Switch

Returns a new instance of Switch.



44
45
46
47
# File 'lib/ejt_command_line.rb', line 44

def initialize(flags, parser = nil)
  @flags = flags
  @parser = parser
end

Instance Attribute Details

#flagsObject (readonly)

Returns the value of attribute flags.



42
43
44
# File 'lib/ejt_command_line.rb', line 42

def flags
  @flags
end

#parserObject (readonly)

Returns the value of attribute parser.



42
43
44
# File 'lib/ejt_command_line.rb', line 42

def parser
  @parser
end

Instance Method Details

#has_flag?(flag) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/ejt_command_line.rb', line 49

def has_flag?(flag)
  @flags.member?(flag)
end