oxmlk 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -2,14 +2,9 @@ module OxMlk
2
2
 
3
3
  class Description
4
4
  PROCESSORS = {
5
- :elem => {
6
- :value => proc {|x| x.content rescue nil},
7
- Integer => proc {|x| x.content.to_i rescue nil},
8
- Float => proc {|x| x.content.to_f rescue nil}
9
- },
10
- :attribute => {
11
- :value => proc {|x| x.value rescue nil}
12
- }
5
+ :value => proc {|x| x.value rescue nil},
6
+ Integer => proc {|x| x.value.to_i rescue nil},
7
+ Float => proc {|x| x.value.to_f rescue nil}
13
8
  }
14
9
 
15
10
  attr_reader :xpath
@@ -139,7 +134,7 @@ module OxMlk
139
134
  def coputed_processor
140
135
  return proc {|x| Hash[*@as.map{|o| [o.ox_tag,o]}.flatten][x.name].from_xml(x) } if collection? && ox_object?
141
136
  processor = [*@as].first || :value
142
- PROCESSORS[ox_type][processor] || processor
137
+ PROCESSORS[processor] || processor
143
138
  end
144
139
 
145
140
  def wrap(xpath=nil)
data/lib/oxmlk/xml.rb CHANGED
@@ -10,6 +10,8 @@ module OxMlk
10
10
  Error = LibXML::XML::Error
11
11
 
12
12
  class Node
13
+ alias_method :value, :content
14
+
13
15
  def self.from(data)
14
16
  case data
15
17
  when XML::Document
data/oxmlk.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{oxmlk}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh Robinson"]
data/spec/xml_spec.rb CHANGED
@@ -61,4 +61,14 @@ describe OxMlk::XML::Node, '#build' do
61
61
  it 'should set its attributes to the third argument' do
62
62
  @node.build(*@args).should be_attributes
63
63
  end
64
+ end
65
+
66
+ describe OxMlk::XML::Node, '#value' do
67
+ before(:all) do
68
+ @node = OxMlk::XML::Node.new('test')
69
+ end
70
+
71
+ it 'should be the same as content' do
72
+ @node.value.should == @node.content
73
+ end
64
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxmlk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Robinson