Sha256: da209661fbed932ab3dd202d2f40589d59a03e393db9d1ccd5e351d560999cf2

Contents?: true

Size: 565 Bytes

Versions: 2

Compression:

Stored size: 565 Bytes

Contents

module Frizz
  class Environment
    attr_reader :name

    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
    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

2 entries across 2 versions & 1 rubygems

Version Path
frizz-0.0.3 lib/frizz/environment.rb
frizz-0.0.2 lib/frizz/environment.rb