haml_coffee_assets 1.4.7 → 1.4.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,14 +25,6 @@ end
25
25
  #
26
26
  module HamlCoffeeAssets
27
27
 
28
- # Get the Haml Coffee Assets configuration
29
- #
30
- # @return [HamlCoffeeAssets::Configuration] the configuration object
31
- #
32
- def self.config
33
- @config ||= ::HamlCoffeeAssets::Configuration.new
34
- end
35
-
36
28
  # Get the path to the `hamlcoffee.js.coffee.erb` helper file.
37
29
  #
38
30
  # @return [String] the absolute path to the helpers file
@@ -1,5 +1,13 @@
1
1
  module HamlCoffeeAssets
2
2
 
3
+ # Get the Haml Coffee Assets configuration
4
+ #
5
+ # @return [HamlCoffeeAssets::Configuration] the configuration object
6
+ #
7
+ def self.config
8
+ @config ||= ::HamlCoffeeAssets::Configuration.new
9
+ end
10
+
3
11
  # Haml Coffee configuration object that contains the default values.
4
12
  # It's a plain Ruby object so a Sinatra app doesn't have to depend
5
13
  # on ActiveSupport just because of the Rails engine configuration.
@@ -8,7 +8,7 @@ module HamlCoffeeAssets
8
8
  #
9
9
  class Engine < ::Rails::Engine
10
10
 
11
- config.hamlcoffee = ActiveSupport::OrderedOptions.new
11
+ config.hamlcoffee = ::HamlCoffeeAssets.config
12
12
 
13
13
  # Initialize Haml Coffee Assets after Sprockets
14
14
  #
@@ -17,11 +17,6 @@ module HamlCoffeeAssets
17
17
 
18
18
  # Register tilt template
19
19
  app.assets.register_engine '.hamlc', ::HamlCoffeeAssets::Tilt::TemplateHandler
20
-
21
- # Copy Rails config to the Haml Coffee Assets config
22
- app.config.hamlcoffee.each do |key, value|
23
- HamlCoffeeAssets.config.instance_variable_set("@#{ key }", value)
24
- end
25
20
  end
26
21
 
27
22
  end
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module HamlCoffeeAssets
4
- VERSION = '1.4.7' unless defined?(HamlCoffeeAssets::VERSION)
4
+ VERSION = '1.4.9' unless defined?(HamlCoffeeAssets::VERSION)
5
5
  end
data/lib/js/hamlcoffee.js CHANGED
@@ -363,7 +363,7 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
363
363
 
364
364
  module.exports = HamlCoffee = (function() {
365
365
 
366
- HamlCoffee.VERSION = '1.4.7';
366
+ HamlCoffee.VERSION = '1.4.9';
367
367
 
368
368
  function HamlCoffee(options) {
369
369
  var _base, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _base9, _ref, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
@@ -631,23 +631,23 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
631
631
  }
632
632
  if (code.indexOf('surround') !== -1) {
633
633
  if (this.options.customSurround) {
634
- fn += "surround = " + this.options.customSurround + "\n";
634
+ fn += "surround = (start, end, fn) -> " + this.options.customSurround + ".call(context, start, end, fn)\n";
635
635
  } else {
636
- fn += "surround = (start, end, fn) -> start + fn() + end\n";
636
+ fn += "surround = (start, end, fn) -> start + fn.call(context)?.replace(/^\s+|\s+$/g, '') + end\n";
637
637
  }
638
638
  }
639
639
  if (code.indexOf('succeed') !== -1) {
640
640
  if (this.options.customSucceed) {
641
- fn += "succeed = " + this.options.customSucceed + "\n";
641
+ fn += "succeed = (start, end, fn) -> " + this.options.customSucceed + ".call(context, start, end, fn)\n";
642
642
  } else {
643
- fn += "succeed = (end, fn) -> fn() + end\n";
643
+ fn += "succeed = (end, fn) -> fn.call(context)?.replace(/\s+$/g, '') + end\n";
644
644
  }
645
645
  }
646
646
  if (code.indexOf('precede') !== -1) {
647
647
  if (this.options.customPrecede) {
648
- fn += "precede = " + this.options.customPrecede + "\n";
648
+ fn += "precede = (start, end, fn) -> " + this.options.customPrecede + ".call(context, start, end, fn)\n";
649
649
  } else {
650
- fn += "precede = (start, fn) -> start + fn()\n";
650
+ fn += "precede = (start, fn) -> start + fn.call(context)?.replace(/^\s+/g, '')\n";
651
651
  }
652
652
  }
653
653
  fn += "$o = []\n";
@@ -86,7 +86,7 @@ class window.HAML
86
86
  # @return [String] the surrounded text
87
87
  #
88
88
  @surround: (start, end, fn) ->
89
- start + fn() + end
89
+ start + fn.call(@)?.replace(/^\s+|\s+$/g, '') + end
90
90
 
91
91
  # The succeed helper appends text to the function output
92
92
  # without whitespace in between.
@@ -96,7 +96,7 @@ class window.HAML
96
96
  # @return [String] the succeeded text
97
97
  #
98
98
  @succeed: (end, fn) ->
99
- fn() + end
99
+ fn.call(@)?.replace(/\s+$/g, '') + end
100
100
 
101
101
  # The precede helper prepends text to the function output
102
102
  # without whitespace in between.
@@ -106,4 +106,4 @@ class window.HAML
106
106
  # @return [String] the preeceded text
107
107
  #
108
108
  @precede: (start, fn) ->
109
- start + fn()
109
+ start + fn.call(@)?.replace(/^\s+/g, '')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_coffee_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.9
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: 2012-09-03 00:00:00.000000000 Z
12
+ date: 2012-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coffee-script
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: -3085028744249036389
111
+ hash: 1221451205017024980
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements: