Class: String

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

Instance Method Summary collapse

Instance Method Details

#boolean_switch?Boolean

Returns:

  • (Boolean)


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

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

#long_switch?Boolean

Returns:

  • (Boolean)


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

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

#short_switch?Boolean

Returns:

  • (Boolean)


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

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