Class Vcs::Switch
In: lib/vcs/vcs.rb
Parent: Object

Methods

new   pre?   to_a_for_option_parser   to_s   to_sym  

Attributes

aliases  [R] 
argument  [R] 
comment  [R] 
main  [R] 

Public Class methods

[Source]

# File lib/vcs/vcs.rb, line 228
    def initialize ( aString )
      match = @@re.match(aString)
      raise "Cannot parse switch: `#{aString}'" if match.nil?
      @pre = match[1] == '*PRE*'
      @main = match[2]
      @argument, @type, @comment = match[5..7]
      @type = eval(@type) unless @type.nil?
      @aliases = match[3..4].compact
    end

Public Instance methods

[Source]

# File lib/vcs/vcs.rb, line 251
    def pre?
      @pre
    end

[Source]

# File lib/vcs/vcs.rb, line 242
    def to_a_for_option_parser
      argument = (@argument.nil? || @argument.empty?)? '' : ' ' + @argument
      @aliases + ["#@main#{argument}", @type].compact
    end

[Source]

# File lib/vcs/vcs.rb, line 238
    def to_s
      @main
    end

[Source]

# File lib/vcs/vcs.rb, line 247
    def to_sym
      @main.gsub(/^-+/, '').gsub('-', '_').sub(/^no_/, '').to_sym
    end

[Validate]