Sha256: deceef2b3432a4165ac1156427e1bf77830aea53f4546b30c42f7401b12d2954

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require "dldinternet/mixlib/cli/version"
require "mixlib/cli"

module DLDInternet
  module Mixlib
    module CLI

      include ::Mixlib::CLI

      def self.included(receiver)
        receiver.extend(::Mixlib::CLI::ClassMethods)

        receiver.class_eval do

          # --------------------------------------------------------------------------------
          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

        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dldinternet-mixlib-cli-0.0.7 lib/dldinternet/mixlib/cli.rb
dldinternet-mixlib-cli-0.0.5 lib/dldinternet/mixlib/cli.rb