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, multi = false) ⇒ Switch

Returns a new instance of Switch.



31
32
33
34
35
# File 'lib/ejt_command_line.rb', line 31

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

Instance Attribute Details

#flagsObject (readonly)

Returns the value of attribute flags.



29
30
31
# File 'lib/ejt_command_line.rb', line 29

def flags
  @flags
end

#multiObject (readonly)

Returns the value of attribute multi.



29
30
31
# File 'lib/ejt_command_line.rb', line 29

def multi
  @multi
end

#parserObject (readonly)

Returns the value of attribute parser.



29
30
31
# File 'lib/ejt_command_line.rb', line 29

def parser
  @parser
end

Instance Method Details

#has_flag?(flag) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/ejt_command_line.rb', line 37

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