acdc 0.7.2 → 0.7.3

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.
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.
@@ -11,7 +11,7 @@ class Boolean; end
11
11
  module AcDc
12
12
 
13
13
  DEFAULT_NAMESPACE = "acdc"
14
- VERSION = [0,7,2]
14
+ VERSION = [0,7,3]
15
15
 
16
16
  def self.parseable_constants
17
17
  @parseables ||= []
@@ -20,7 +20,7 @@ module AcDc
20
20
  body << value.acdc(false)
21
21
  end
22
22
  else
23
- body.tag! elem.tag
23
+ body.tag! elem.tag if elem.renderable?
24
24
  end
25
25
  end
26
26
  }
@@ -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
@@ -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.2
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-09-19 00:00:00 -07:00
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.2
81
+ summary: acdc 0.7.3
82
82
  test_files: []
83
83