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 +4 -4
- data/README.md +5 -0
- data/h2ocube_rails_helper.gemspec +1 -1
- data/lib/h2ocube_rails_helper.rb +20 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef3e59b33c959c430fb6d5a027c6524ab140d215
|
4
|
+
data.tar.gz: 8c35178f7a261518006c4f947fe723fba81653d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 222725713d453084b9a68bba700cdfdf084d48af9b36dc04e50d740fa622c4926f6ccc36accfb6c542374e5aa9aace813e557ad9ce4c92e3cc2dd3bf2e779f53
|
7
|
+
data.tar.gz: 2487ada42816712cbde82dfa79885a04e49ab8fc8557a5a79a492996d4a8426a69b8bb9c715386995206c82fa273e2a265415f1417bb75bc2bdeee2075093723
|
data/README.md
CHANGED
@@ -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.
|
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'
|
data/lib/h2ocube_rails_helper.rb
CHANGED
@@ -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
|
23
|
-
|
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
|
92
|
+
cls.push browser.to_s
|
80
93
|
|
81
94
|
cls.compact.uniq.join ' '
|
82
95
|
end
|