Class: String

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

Instance Method Summary collapse

Instance Method Details

#boolean_switch?Boolean

Returns:

  • (Boolean)


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

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

#long_switch?Boolean

Returns:

  • (Boolean)


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

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

#short_switch?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/Switches.rb', line 25

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