Sha256: f3985ca88ed640762871d4e3a96a9cfe47e6a4d5ce0c3fb64a09b82d0fc7949f

Contents?: true

Size: 530 Bytes

Versions: 16

Compression:

Stored size: 530 Bytes

Contents

# When included, this module allows another module to be called setting a default preset
#
# Examples:
# Maestrano::Settings.new               # Uses 'default' preset
# Maestrano['mypreset']::Settings.new   # Uses 'mypreset'
module Maestrano
  module Preset
    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
      def [](preset)
        define_singleton_method(:preset) { preset || 'default' }        
        self
      end

      def preset
        'default'
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
maestrano-1.0.1 lib/maestrano/preset.rb
maestrano-1.0.0 lib/maestrano/preset.rb
maestrano-1.0.0.pre.RC9 lib/maestrano/preset.rb
maestrano-1.0.0.pre.RC8 lib/maestrano/preset.rb
maestrano-1.0.0.pre.RC7 lib/maestrano/preset.rb
maestrano-1.0.0.pre.RC6 lib/maestrano/preset.rb
maestrano-1.0.0.pre.RC5 lib/maestrano/preset.rb
maestrano-1.0.0.pre.RC4 lib/maestrano/preset.rb
maestrano-1.0.0.pre.RC3 lib/maestrano/preset.rb
maestrano-1.0.0.pre.RC2 lib/maestrano/preset.rb
maestrano-1.0.0.pre.RC1 lib/maestrano/preset.rb
maestrano-0.12.5 lib/maestrano/preset.rb
maestrano-0.12.4 lib/maestrano/preset.rb
maestrano-0.12.3 lib/maestrano/preset.rb
maestrano-0.12.2 lib/maestrano/preset.rb
maestrano-0.12.1 lib/maestrano/preset.rb