acdc 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +2 -2
- data/lib/acdc.rb +1 -1
- data/lib/acdc/build.rb +1 -1
- data/lib/acdc/item.rb +6 -0
- data/lib/acdc/mapping.rb +5 -1
- metadata +3 -3
data/README
CHANGED
@@ -41,8 +41,8 @@ marshaling those objects from XML a breeze.
|
|
41
41
|
|
42
42
|
I want to thank John Nunemaker for his HappyMapper gem. I stole quite a bit
|
43
43
|
of code from that gem.
|
44
|
-
http://railstips.org/2008/11/17/happymapper-making-xml-fun-again
|
45
|
-
http://github.com/jnunemaker/happymapper/
|
44
|
+
* http://railstips.org/2008/11/17/happymapper-making-xml-fun-again
|
45
|
+
* http://github.com/jnunemaker/happymapper/
|
46
46
|
|
47
47
|
And if you might ask why not just use his library? Well - that's the acdc part
|
48
48
|
of this story. He had the AC - I added the DC.
|
data/lib/acdc.rb
CHANGED
data/lib/acdc/build.rb
CHANGED
data/lib/acdc/item.rb
CHANGED
@@ -7,6 +7,8 @@ module AcDc
|
|
7
7
|
def initialize(name, type, options={})
|
8
8
|
@name = name.to_s
|
9
9
|
@type = type
|
10
|
+
@renderable = options.delete(:render_empty)
|
11
|
+
@renderable = true if @renderable.nil?
|
10
12
|
@tag = options.delete(:tag) ||
|
11
13
|
@type.tag_name rescue nil ||
|
12
14
|
name.to_s
|
@@ -14,6 +16,10 @@ module AcDc
|
|
14
16
|
@xml_type = self.class.to_s.split('::').last.downcase
|
15
17
|
end
|
16
18
|
|
19
|
+
def renderable?
|
20
|
+
@renderable
|
21
|
+
end
|
22
|
+
|
17
23
|
def method_name
|
18
24
|
@method_name ||= name.tr('-','_')
|
19
25
|
end
|
data/lib/acdc/mapping.rb
CHANGED
@@ -49,7 +49,11 @@ module AcDc
|
|
49
49
|
|
50
50
|
private
|
51
51
|
def make_accessor(item)
|
52
|
-
safe_name = item.name.tr('-','_')
|
52
|
+
safe_name = item.name.tr('-','_')
|
53
|
+
# I find this to be brittle because of other libraries ability
|
54
|
+
# to add methods the way we do. Leaving for now - however
|
55
|
+
# there has to be a better way to isolate the method name
|
56
|
+
# from our own @elements/@attributes
|
53
57
|
if instance_methods.include?(safe_name)
|
54
58
|
name = "#{item.element? ? "element_" : "attribute_"}#{safe_name}"
|
55
59
|
item.name = name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acdc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clint Hill
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -78,6 +78,6 @@ rubyforge_project:
|
|
78
78
|
rubygems_version: 1.3.5
|
79
79
|
signing_key:
|
80
80
|
specification_version: 3
|
81
|
-
summary: acdc 0.7.
|
81
|
+
summary: acdc 0.7.3
|
82
82
|
test_files: []
|
83
83
|
|