frizz 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,10 +17,8 @@ module Frizz
17
17
  @bucket ||= @host
18
18
  end
19
19
 
20
- # This is a creative way to allow for calling frizz.production? or
21
- # frizz.staging? from the Middleman view helpers
22
- def method_missing(meth, *args, &block)
23
- "#{name}?" == meth.to_s
24
- end
20
+ # Don't raise on undefined methods. Allows for flexible use of frizz.yml
21
+ # attributes.
22
+ def method_missing(meth, *args, &block); end
25
23
  end
26
24
  end
@@ -2,7 +2,30 @@ module Frizz
2
2
  module Middleman
3
3
  module ViewHelpers
4
4
  def frizz
5
- Frizz.configuration.environment
5
+ @frizz ||= EnvironmentDecorator.new(Frizz.configuration)
6
+ end
7
+
8
+ class EnvironmentDecorator
9
+ attr_accessor :config
10
+
11
+ def initialize(config)
12
+ @config = config
13
+ define_environment_helpers!
14
+ end
15
+
16
+ def method_missing(meth, *args, &block)
17
+ config.environment.send(meth) # pass thru to environment attrs
18
+ end
19
+
20
+ private
21
+
22
+ def define_environment_helpers!
23
+ config.environments.each do |name, env|
24
+ self.class.send :define_method, "#{env.name}?" do
25
+ env == config.environment
26
+ end
27
+ end
28
+ end
6
29
  end
7
30
  end
8
31
  end
data/lib/frizz/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Frizz
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: frizz
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.2
5
+ version: 1.3.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - patbenatar
@@ -144,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  segments:
146
146
  - 0
147
- hash: -4055594557459652094
147
+ hash: -2310730605007625868
148
148
  version: '0'
149
149
  none: false
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  - !ruby/object:Gem::Version
154
154
  segments:
155
155
  - 0
156
- hash: -4055594557459652094
156
+ hash: -2310730605007625868
157
157
  version: '0'
158
158
  none: false
159
159
  requirements: []