fanforce-internal-utils 0.1.3 → 0.1.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGQzYWQ0MGI5YzE2MTBhY2JkYzIwZmY5MDM3ZmNkYTJjNmM2NjVlYw==
4
+ NWM5MDQxZDc2NmI0YjZkYzEzMDJhZjE5MjEzYjg5OWZmYTJiZTY5OA==
5
5
  data.tar.gz: !binary |-
6
- ZTFkODYwOTc5ZTdlYmE0MmE0NzAwYzAyZWExNjMxODc4MGQ0MjI4Yw==
6
+ NDAyY2I1ZDhmNjMyNjgyNWZiNGU5OWY3Mzc4YjA0NjE3ZWIyNDhjZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjU4MTEzODM5YWE1MWJmMzEyZWI2MmIzYmYxNjllZWNmNzU4NzRjZmQ5MDcx
10
- YWQyMTA5ZWUwYmEzMjdjOTQ5NGNhYTBlNTBlZmIwOTNhNGRmZjI5MzliNDRm
11
- NzliNmQ2MzJlOGQ1OTVhZGE5Yjc1ZThiMzI0NDE2YmVkODkxODk=
9
+ ZDkxNTM1ODU0NjA1Njg3Y2QzZDZlZDE1ZmE1YTAwYzVlMmQyZDNjY2EyOGQ4
10
+ YzgxNzA2OWIzNTI2MWI3MWY4NjgxYzFiMDUxYTZhZjYzOTZiZjJmOTY2NDNk
11
+ NWJlZDQxOTU5OTlkMDA3ZTgzZDE5ZGYwOTUxNzIzNDg5YTJkYWM=
12
12
  data.tar.gz: !binary |-
13
- YjZmZjZhOTJhMDhlNjAzYTJhODc4ZjM2OTIxODE2OWM3NGEzZmM1YjAyM2Mw
14
- ZDA0NjAwYjVjN2ZlMjZhOWE1MzIzNWY2ZjVkZDg1ZWU0ZDQ0MzY4ZWE4ZTQ4
15
- Mzc2YjI3NjJjZjEwNjFlNzE1M2U4NWJkZjJiNTE2YmQ1ZThkOGE=
13
+ ZTc1ZTgyNDIzNzY4YjAyMjkyMjZkZGQ1NDM2YmYwNjFmYWY1ZTFhNjBhYzc5
14
+ MzY5OWYzNzM0M2RkYWFmODk4NTRlZjk4Mzc2NGI1ZjhiODBjNDY2M2Y0Mzgy
15
+ NmY4Mjk0MjA2MDkxYjNmZjAyYWFiNTkzMmM0YWI0NGZkZWM1ZGM=
@@ -70,25 +70,20 @@ module Fanforce::Utils
70
70
 
71
71
  # Creates a string representation of a javascript object for $.tmpl
72
72
  def compile_jquery_tmpls(options={}, &block)
73
- begin require 'haml' rescue LoadError raise "You must have the haml gem installed for Fanforce.compile_jquery_templates to work." end
73
+ begin require 'haml' rescue LoadError raise 'You must have the haml gem installed to use Fanforce.compile_jquery_templates.' end
74
74
  context = Object.new
75
75
  class << context
76
76
  include Haml::Helpers
77
77
  end
78
78
  context.init_haml_helpers
79
79
 
80
- format = if options[:format] == 'html' then :html else options[:callback].present? ? :jsonp : :json end
80
+ format = options[:format] == 'html' ? :html : :json
81
81
 
82
82
  return context.capture_haml(&block) if format == :html
83
83
  single_line_html = context.capture_haml(&block).split(/\r?\n/).inject('') {|sl, l| sl += l.strip + ' ' }
84
84
  matches = single_line_html.scan(/<script id=[\"'](.*?)[\"'](?:.*?)>(.*?)(?:<\/script>)/mi)
85
85
 
86
- templates = matches.inject({}) {|t,m| t[m[0]] = m[1]; t }
87
- if format == :jsonp
88
- "#{options[:callback]}(#{templates.to_json})"
89
- else
90
- templates.to_json
91
- end
86
+ matches.inject({}) {|t,m| t[m[0]] = m[1]; t }.to_json
92
87
  end
93
88
 
94
89
  end
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  module Utils
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-internal-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark