Sha256: 647800ead0d79ab3b867e743bd9326eba0f1d0ba5c1b7013ede0144ad8c335c0

Contents?: true

Size: 783 Bytes

Versions: 52

Compression:

Stored size: 783 Bytes

Contents

module Sprinkle
  #--
  # TODO: Possible documentation?
  #++
  module Configurable #:nodoc:
    attr_accessor :delivery
    
    def defaults(deployment)
      defaults = deployment.defaults[self.class.name.split(/::/).last.downcase.to_sym]
      self.instance_eval(&defaults) if defaults
      @delivery = deployment.style
    end
    
    def assert_delivery
      raise 'Unknown command delivery target' unless @delivery
    end
    
    def method_missing(sym, *args, &block)
      unless args.empty? # mutate if not set
        @options ||= {}
        @options[sym] = *args unless @options[sym]
      end

      @options[sym] || @package.send(sym, *args, &block) # try the parents options if unknown
    end
    
    def option?(sym)
      !@options[sym].nil?
    end
  end
end

Version data entries

52 entries across 52 versions & 11 rubygems

Version Path
crafterm-sprinkle-0.1.6 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.1.7 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.1.8 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.1.9 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.2.0 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.2.1 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.2.2 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.2.3 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.2.4 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.2.5 lib/sprinkle/configurable.rb
crafterm-sprinkle-0.2.6 lib/sprinkle/configurable.rb
jemmyw-sprinkle-0.2.3 lib/sprinkle/configurable.rb
jemmyw-sprinkle-0.2.4 lib/sprinkle/configurable.rb
jsierles-sprinkle-0.1.9 lib/sprinkle/configurable.rb
justsee-sprinkle-0.2.4 lib/sprinkle/configurable.rb
lachlan-sprinkle-0.0.1 lib/sprinkle/configurable.rb
lachlan-sprinkle-0.0.10 lib/sprinkle/configurable.rb
lachlan-sprinkle-0.0.11 lib/sprinkle/configurable.rb
lachlan-sprinkle-0.0.13 lib/sprinkle/configurable.rb
lachlan-sprinkle-0.0.14 lib/sprinkle/configurable.rb