h2ocube_rails_helper 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55dab7f856af3ade14b8678dd3fa0a88173307cf
4
- data.tar.gz: e5dcff28c9c48499d67c1db233193eab1c7fd29e
3
+ metadata.gz: ef3e59b33c959c430fb6d5a027c6524ab140d215
4
+ data.tar.gz: 8c35178f7a261518006c4f947fe723fba81653d5
5
5
  SHA512:
6
- metadata.gz: 0326543897681548b45a4ed6bb67ccbb27cb213a734bd139fe6f5a2bf9d520832b79b8fa5868d6fdc0bff0c4c4046ba892bb8abd901b8d68abd619343a54c5dc
7
- data.tar.gz: 15f88fb00dafb719a41c1bab8d65de0b532594071fd7425e6adfd099f7b95fcb3198ee82e375d983535fef5f39fd7a5636ab4e2d7d714420ac0ea9ec2d8d7baf
6
+ metadata.gz: 222725713d453084b9a68bba700cdfdf084d48af9b36dc04e50d740fa622c4926f6ccc36accfb6c542374e5aa9aace813e557ad9ce4c92e3cc2dd3bf2e779f53
7
+ data.tar.gz: 2487ada42816712cbde82dfa79885a04e49ab8fc8557a5a79a492996d4a8426a69b8bb9c715386995206c82fa273e2a265415f1417bb75bc2bdeee2075093723
data/README.md CHANGED
@@ -18,6 +18,11 @@ And then execute:
18
18
 
19
19
  ## Usage
20
20
 
21
+ escape #=> CGI.escapeHTML
22
+ unescape #=> CGI.unescapeHTML
23
+
24
+ browser #=> new Browser object
25
+
21
26
  render_html_class #=> controller_name action_name controller_name_action_name devise_meta
22
27
 
23
28
  render_title
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'h2ocube_rails_helper'
7
- gem.version = '0.1.1'
7
+ gem.version = '0.1.2'
8
8
  gem.authors = ['Ben']
9
9
  gem.email = ['ben@h2ocube.com']
10
10
  gem.description = 'Just an helper collection'
@@ -14,14 +14,15 @@ module Browser
14
14
  def desktop?
15
15
  !ua.blank? && !device.mobile?
16
16
  end
17
- end
18
-
19
- class Generic < Base
20
- alias _full_version full_version
21
17
 
22
- def full_version
23
- ua.blank? ? '0.0' : _full_version
18
+ def meta
19
+ Meta.constants.each_with_object(Set.new) do |meta_name, meta|
20
+ meta_class = Meta.const_get(meta_name)
21
+ meta.merge(meta_class.new(self).to_a)
22
+ end.to_a
24
23
  end
24
+
25
+ alias to_a meta
25
26
  end
26
27
 
27
28
  class Device
@@ -56,6 +57,18 @@ end
56
57
  module H2ocubeRailsHelper
57
58
  module ActionView
58
59
  module Helpers
60
+ def escape(text)
61
+ CGI.escapeHTML text
62
+ end
63
+
64
+ def unescape(text)
65
+ CGI.unescapeHTML text
66
+ end
67
+
68
+ def browser
69
+ @_browser ||= Browser.new request.env['HTTP_USER_AGENT'], accept_language: request.env['HTTP_ACCEPT_LANGUAGE']
70
+ end
71
+
59
72
  def render_html_class
60
73
  cls = []
61
74
  if params[:controller].include?('/')
@@ -76,7 +89,7 @@ module H2ocubeRailsHelper
76
89
  end
77
90
  end
78
91
 
79
- cls.push Browser.new(request.env['HTTP_USER_AGENT']).to_s
92
+ cls.push browser.to_s
80
93
 
81
94
  cls.compact.uniq.join ' '
82
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: h2ocube_rails_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben