Sha256: e7b3ea086baa1ea3bf88e594312c9c14a9c745b1405a0dac049485ff42aa0c1e

Contents?: true

Size: 669 Bytes

Versions: 53

Compression:

Stored size: 669 Bytes

Contents

module Temple
  module Mixins
    # @api public
    module DefaultOptions
      def set_default_options(options)
        default_options.update(options)
      end

      def default_options
        @default_options ||= MutableHash.new(superclass.respond_to?(:default_options) ?
                                             superclass.default_options : nil)
      end
    end

    # @api public
    module Options
      def self.included(base)
        base.class_eval { extend DefaultOptions }
      end

      attr_reader :options

      def initialize(options = {})
        @options = ImmutableHash.new(options, self.class.default_options)
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 2 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.7.4 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.7.3 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.7.2 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.7.1 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.7.0 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.9 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.8 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.7 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.6 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.5 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.4 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.3 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.2 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.1 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.6.0 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.5.17 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.5.16 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.5.15 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb
classiccms-0.5.14 vendor/bundle/gems/temple-0.4.0/lib/temple/mixins/options.rb