iron-web 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Version.txt +1 -1
- data/lib/iron/web/html.rb +10 -0
- data/lib/iron/web/html/element.rb +8 -0
- data/spec/web/element_spec.rb +12 -0
- metadata +17 -7
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.0.2 / 2012-06-03
|
2
|
+
|
3
|
+
* Add ability to access attributes on elements using []/[]=
|
4
|
+
* Add respond_to_missing? on Html so it will #respond_to?(:div) correctly
|
5
|
+
|
1
6
|
== 1.0.1 / 2012-03-30
|
2
7
|
|
3
8
|
* Clear out Html::Element of kernel/object methods so attributes like 'class' can be set correctly
|
data/Version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/iron/web/html.rb
CHANGED
@@ -113,6 +113,16 @@ class Html
|
|
113
113
|
super
|
114
114
|
end
|
115
115
|
end
|
116
|
+
|
117
|
+
# Make sure our objects advertise their support of tags
|
118
|
+
def respond_to_missing?(method, include_private)
|
119
|
+
parts = method.to_s.match(/^([a-z]+[0-9]?)$/)
|
120
|
+
if parts
|
121
|
+
true
|
122
|
+
else
|
123
|
+
super
|
124
|
+
end
|
125
|
+
end
|
116
126
|
|
117
127
|
# Renders out as html - accepts depth param to indicate level of indentation
|
118
128
|
def render(depth = 0, inblock = true)
|
data/spec/web/element_spec.rb
CHANGED
@@ -49,6 +49,18 @@ describe Html::Element do
|
|
49
49
|
span.render.should == '<span class="dynamic frenetic" id="header"></span>'
|
50
50
|
end
|
51
51
|
|
52
|
+
it 'should add attributes using []=' do
|
53
|
+
div = Html::Element.new(:div)
|
54
|
+
div['foo'] = 2
|
55
|
+
div.attrs.keys.should include(:foo)
|
56
|
+
div.render.should == "\n<div foo=\"2\"></div>\n"
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should allow reading attributes using []' do
|
60
|
+
div = Html::Element.new(:div, :bar => 'hi')
|
61
|
+
div[:bar].should == 'hi'
|
62
|
+
end
|
63
|
+
|
52
64
|
it 'should yield a block for customization on creation' do
|
53
65
|
Html::Element.new(:span) {|span|
|
54
66
|
span.id = 'fun'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron-extensions
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '2.6'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.6'
|
36
46
|
description: Html builder, color helper class and url parser/builder class for use
|
37
47
|
in Rails projects or other web-based content generation.
|
38
48
|
email:
|
@@ -80,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
90
|
version: '0'
|
81
91
|
requirements: []
|
82
92
|
rubyforge_project:
|
83
|
-
rubygems_version: 1.8.
|
93
|
+
rubygems_version: 1.8.24
|
84
94
|
signing_key:
|
85
95
|
specification_version: 3
|
86
96
|
summary: Helper classes for generating web content
|