Sha256: 12472d62af43d8e407b5ec471707f3c01b9efdb48a807c0755b22192644c88a7

Contents?: true

Size: 606 Bytes

Versions: 1

Compression:

Stored size: 606 Bytes

Contents

module Frizz
  class Environment
    attr_reader :name, :bucket

    def initialize(name, data)
      @name = name

      data.each do |attribute, value|
        ivar_name = "@#{attribute}"
        instance_variable_set(ivar_name, value)

        self.class.send :define_method, attribute do
          instance_variable_get(ivar_name)
        end
      end

      @bucket ||= @host
    end

    # This is a creative way to allow for calling frizz.production? or
    # frizz.staging? from the Middleman view helpers
    def method_missing(meth, *args, &block)
      "#{name}?" == meth.to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frizz-1.3.2 lib/frizz/environment.rb