Class: String

Inherits:
Object show all
Defined in:
lib/Switches.rb

Instance Method Summary collapse

Instance Method Details

#boolean_switch?Boolean

Returns:

  • (Boolean)


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

def boolean_switch?
  self =~ /\?$/
end

#long_switch?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/Switches.rb', line 38

def long_switch?
  (self =~ /^..+$/ && !short_switch?) || self =~ /^..+\?$/ || self =~ /^..+!$/
end

#short_switch?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/Switches.rb', line 34

def short_switch?
  self =~ /^.$/ || self =~ /^.\?$/ || self =~ /^.\!$/
end