reviewed_braai 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ module ReviewedBraai
15
15
 
16
16
  if error[:airbrake] && defined?(Airbrake)
17
17
  Airbrake.notify(error)
18
- elsif defined?(Rails)
18
+ elsif defined?(Rails) && defined?(Rails.logger)
19
19
  Rails.logger.warn(error.to_s)
20
20
  end
21
21
 
@@ -1,12 +1,5 @@
1
1
  module ReviewedBraai
2
2
  module Handlers
3
- class Default < ReviewedBraai::Handlers::Base
4
- def perform
5
- attr = template.attributes[matches.last]
6
- attr ? attr.to_s : "<!-- #{matches.last} -->"
7
- end
8
- end
9
-
10
3
  class DefaultRegion < ReviewedBraai::Handlers::Base
11
4
  def perform
12
5
  return nil unless matches[1] == matches[-1]
@@ -1,11 +1,5 @@
1
1
  module ReviewedBraai
2
2
  module Handlers
3
- class ProductMethod < ReviewedBraai::Handlers::Base
4
- def perform
5
- primary_product.send(matches[1])
6
- end
7
- end
8
-
9
3
  class ProductVanity < ReviewedBraai::Handlers::Base
10
4
  def perform
11
5
  attachment = match_attachment_by_tag(primary_product.attachments, "vanity")
@@ -13,13 +7,6 @@ module ReviewedBraai
13
7
  end
14
8
  end
15
9
 
16
- class ProductBrandMethod < ReviewedBraai::Handlers::Base
17
- def perform
18
- brand = match_brand
19
- brand.send(matches[1])
20
- end
21
- end
22
-
23
10
  class ProductAttachmentById < ReviewedBraai::Handlers::Base
24
11
  def perform
25
12
  attachment = match_attachment(primary_product.attachments, :id, matches[1])
@@ -1,9 +1,11 @@
1
1
  module ReviewedBraai
2
2
  module Matchers
3
3
  module Default
4
- # Overwrite default catch-all route (respects template variables)
5
- Braai::Template.map(/({{\s*([\w]+)\s*}})/i, ReviewedBraai::Handlers::Default)
6
- Braai::Template.map(/({{\s*([\w]+)\s*}}(.*){{\s*\/([\w]+)\s*}})/mi, ReviewedBraai::Handlers::DefaultRegion)
4
+ Braai::Template.map(Braai::Matchers::RegionMatcher, ReviewedBraai::Handlers::DefaultRegion)
5
+
6
+ Braai::Handlers::Default.nomatch_handler = ->(value) do
7
+ "<!-- #{value} -->"
8
+ end
7
9
  end
8
10
  end
9
11
  end
@@ -2,8 +2,8 @@ module ReviewedBraai
2
2
  module Matchers
3
3
  module Product
4
4
  Braai::Template.map(/({{\s*product\.vanity\s*}})/i, ReviewedBraai::Handlers::ProductVanity)
5
- Braai::Template.map(/({{\s*product\.(\w+)\s*}})/i, ReviewedBraai::Handlers::ProductMethod)
6
- Braai::Template.map(/({{\s*product\.brand\.(\w+)\s*}})/i, ReviewedBraai::Handlers::ProductBrandMethod)
5
+ # Braai::Template.map(/({{\s*product\.(\w+)\s*}})/i, ReviewedBraai::Handlers::ProductMethod)
6
+ # Braai::Template.map(/({{\s*product\.brand\.(\w+)\s*}})/i, ReviewedBraai::Handlers::ProductBrandMethod)
7
7
  Braai::Template.map(/({{\s*product.attachments\((\w+)\)\s*}})/i, ReviewedBraai::Handlers::ProductAttachmentById)
8
8
  Braai::Template.map(/({{\s*product.attachments\[['|"]([^\]\}]+)['|"]\]\s*}})/i, ReviewedBraai::Handlers::ProductAttachmentByName)
9
9
  Braai::Template.map(/({{\s*product.manufacturer_specs\[['|"]([^\]\}]+)['|"]\]\s*}})/i, ReviewedBraai::Handlers::ProductManufacturerSpec)
@@ -1,3 +1,3 @@
1
1
  module ReviewedBraai
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reviewed_braai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-30 00:00:00.000000000 Z
12
+ date: 2013-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: braai
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.4.0
21
+ version: 1.4.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.4.0
29
+ version: 1.4.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rspec
32
32
  requirement: !ruby/object:Gem::Requirement