inline_templates 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37edba5533b3f50ef02c284d351c0c30c91a8956
4
- data.tar.gz: 0b9900b7d7c207ba0db0b300ec4c68aa77e9cc2d
3
+ metadata.gz: a7fb94853f697e407abafb16028f0a97b1ff3890
4
+ data.tar.gz: c32da98602fa1183161545e443f13325a5ca69f4
5
5
  SHA512:
6
- metadata.gz: aebdef1aab1a2f7069f5b3abe2cf9c4a9de962305baef2f7db675c8df820f3fcc6c7dccdd505a0aaec270eec82e3b921f0b60d41d6305823c4adbeae1aa9ced6
7
- data.tar.gz: e0d13dbc6a3fcb33b765e983d57adb8968908368608ab65cf7d069b83c4b55ac262ba4aec56b63ce0fef56d3f81d06665e344be73762f7d1575cd117dc3de362
6
+ metadata.gz: df6e7c390591de57e2668101ac183a061e06d9902f45a78cef8e81b7d9e23314ab1b7f53f913ea2a6ae17faf7ed35c4c29aaae4186af55ff05a47a34756722ae
7
+ data.tar.gz: 52b3ad3309433127d615c387bf86371fcb99678421fa1954ceed9048479760ea252736e641afc784d01237b4114f98c667b5b0232b0ba655b71bf6744564856f
@@ -1,5 +1,6 @@
1
1
  require "active_support"
2
2
  require "action_view"
3
+ require 'set'
3
4
 
4
5
  require "inline_templates/version"
5
6
  require "inline_templates/builder"
@@ -2,6 +2,8 @@ module InlineTemplates
2
2
  class BufferWrapper < BlankObject
3
3
  make_blank :respond_to?
4
4
 
5
+ IMPLICIT_CAST_METHODS = ::Set.new([ :to_int, :to_ary, :to_str, :to_sym, :to_hash, :to_proc, :to_io ])
6
+
5
7
  def initialize(object, buffer)
6
8
  @object = object
7
9
  @buffer = buffer
@@ -20,7 +22,7 @@ module InlineTemplates
20
22
 
21
23
  result = @object.__send__(name, *args, &block)
22
24
 
23
- return result if name.to_s == "to_str"
25
+ return result if IMPLICIT_CAST_METHODS.include?(name.to_sym)
24
26
 
25
27
  BufferWrapper.wrap result, @buffer
26
28
  end
@@ -1,3 +1,3 @@
1
1
  module InlineTemplates
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Gridasov