haml-edge 2.3.10 → 2.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.10
1
+ 2.3.11
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.10
1
+ 2.3.11
data/lib/haml/buffer.rb CHANGED
@@ -278,7 +278,12 @@ RUBY
278
278
  ref = ref[0]
279
279
  # Let's make sure the value isn't nil. If it is, return the default Hash.
280
280
  return {} if ref.nil?
281
- class_name = underscore(ref.class)
281
+ class_name =
282
+ if ref.respond_to?(:haml_object_ref)
283
+ ref.haml_object_ref
284
+ else
285
+ underscore(ref.class)
286
+ end
282
287
  id = "#{class_name}_#{ref.id || 'new'}"
283
288
  if prefix
284
289
  class_name = "#{ prefix }_#{ class_name}"
@@ -69,6 +69,11 @@ class EngineTest < Test::Unit::TestCase
69
69
  }
70
70
 
71
71
  User = Struct.new('User', :id)
72
+ class CustomHamlClass < Struct.new(:id)
73
+ def haml_object_ref
74
+ "my_thing"
75
+ end
76
+ end
72
77
 
73
78
  def render(text, options = {}, &block)
74
79
  scope = options.delete(:scope) || Object.new
@@ -755,6 +760,12 @@ END
755
760
  render("%p[user]{:style => 'width: 100px;'} New User", :locals => {:user => user}))
756
761
  end
757
762
 
763
+ def test_object_ref_with_custom_haml_class
764
+ custom = CustomHamlClass.new 42
765
+ assert_equal("<p class='my_thing' id='my_thing_42' style='width: 100px;'>My Thing</p>\n",
766
+ render("%p[custom]{:style => 'width: 100px;'} My Thing", :locals => {:custom => custom}))
767
+ end
768
+
758
769
  def test_non_literal_attributes
759
770
  assert_equal("<p a1='foo' a2='bar' a3='baz' />\n",
760
771
  render("%p{a2, a1, :a3 => 'baz'}/",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.10
4
+ version: 2.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum