Sha256: 56849cc299fae26c81200085169c6b257fe8e69597e035a784c8c105d1ac47be

Contents?: true

Size: 605 Bytes

Versions: 21

Compression:

Stored size: 605 Bytes

Contents

module Relish
  module Command
    module Dsl
      class Option
        include ContextClass
        
        def define(name, options = {})
          name = name.to_s
          default_proc = options[:default] || Proc.new {}

          context_class_eval do
            define_method(name) do
              cli_options[name] ||
              local_options_file[name] ||
              global_options_file[name] ||
              instance_exec(&default_proc)
            end
          end
        end
        
        def self.names
          @@names ||= []
        end
        
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
relish-0.1.0 lib/relish/commands/dsl/option.rb