Sha256: 7eceefcfeee34e6aa3be96e44fccbc86763eefca56ed8d49a9be1dd7dd906e65

Contents?: true

Size: 692 Bytes

Versions: 12

Compression:

Stored size: 692 Bytes

Contents

module Tagomatic

  class LocalOptionsMatcher

    def process!(line)
      @matchdata = LOCAL_OPTIONS_ENTRY_REGEX.match(line)
    end

    def is_valid_option?
      @matchdata.captures.size > 0
    end

    def get_option
      @matchdata.captures[OPTION_MATCH_GROUP_INDEX]
    end

    def has_value?
      @matchdata.captures.size > 2
    end

    def get_value
      @matchdata.captures[VALUE_MATCH_GROUP_INDEX]
    end

    def to_argv
      argv = []
      argv << get_option if is_valid_option?
      argv << get_value if has_value?
      argv
    end

    LOCAL_OPTIONS_ENTRY_REGEX = /(--[^ ]+)( (.+))?/

    OPTION_MATCH_GROUP_INDEX = 0

    VALUE_MATCH_GROUP_INDEX = 2

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
tagomatic-0.1.9 lib/tagomatic/local_options_matcher.rb
tagomatic-0.1.8 lib/tagomatic/local_options_matcher.rb
tagomatic-0.1.7 lib/tagomatic/local_options_matcher.rb
tagomatic-0.1.6 lib/tagomatic/local_options_matcher.rb
tagomatic-0.1.5 lib/tagomatic/local_options_matcher.rb
tagomatic-0.1.4 lib/tagomatic/local_options_matcher.rb
tagomatic-0.1.3 lib/tagomatic/local_options_matcher.rb
tagomatic-0.1.2 lib/tagomatic/local_options_matcher.rb
tagomatic-0.1.1 lib/tagomatic/local_options_matcher.rb
tagomatic-0.1.0 lib/tagomatic/local_options_matcher.rb
tagomatic-0.0.3 lib/tagomatic/local_options_matcher.rb
tagomatic-0.0.2 lib/tagomatic/local_options_matcher.rb