Sha256: 110398b54c3221f7b841f8725ace01d94e50d6fe8fd6d5ee8968d7fb832b855d

Contents?: true

Size: 1.75 KB

Versions: 1

Compression:

Stored size: 1.75 KB

Contents

unless defined? ::DLDInternet::Mixlib::CLI::ClassMethods

  require "dldinternet/mixlib/cli/version"
  module DLDInternet
    module Mixlib
      module CLI
        module ClassMethods
        end

        require "dldinternet/mixlib/cli/mixins/parsers"
        include Parsers
        # ----------------------------------------------------------------------------------------------------------------
        # InstanceMethods
        # ----------------------------------------------------------------------------------------------------------------

        # --------------------------------------------------------------------------------
        def parseString(v)
          v
        end

        # --------------------------------------------------------------------------------
        def parsePath(v)
          File.expand_path(parseString(v))
        end

        # --------------------------------------------------------------------------------
        def parseList(v,s=',',method='parseString')
          parts = []
          a = v.split(%r/#{s}/)
          a.each{ |t|
            parts << send(method,t)
          }
          parts
        end

        # --------------------------------------------------------------------------------
        def parseOptionString(v,s=',',method='parseString')
          bags = []
          if v.match(%r'#{s}')
            bags << parseList(v,s,method)
          else
            bags << send(method,v)
          end
          bags.flatten
        end

        def self.included(receiver)

          receiver.class_eval do
            require "mixlib/cli"
            include ::Mixlib::CLI
          end

          receiver.extend(::Mixlib::CLI::ClassMethods)
          receiver.extend(ClassMethods)

        end

      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dldinternet-mixlib-cli-0.2.0 lib/dldinternet/mixlib/cli.rb