pump 0.3.0 → 0.4.0

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/lib/pump/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pump
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/pump/xml/dsl.rb CHANGED
@@ -26,6 +26,14 @@ module Pump
26
26
  with_type('integer', name, options)
27
27
  end
28
28
 
29
+ def float(name, options={})
30
+ with_type('float', name, options)
31
+ end
32
+
33
+ def boolean(name, options={})
34
+ with_type('boolean', name, options)
35
+ end
36
+
29
37
  def date(name, options={})
30
38
  with_type('date', name, options)
31
39
  end
data/lib/pump/xml.rb CHANGED
@@ -56,7 +56,7 @@ module Pump
56
56
  #
57
57
  # @return [String]
58
58
  def encode(object)
59
- Array === object ? encode_array(object) : encode_single(object)
59
+ object.is_a?(Array) ? encode_array(object) : encode_single(object)
60
60
  end
61
61
 
62
62
  private
@@ -53,6 +53,26 @@ describe Pump::Xml::Dsl do
53
53
  end
54
54
  end
55
55
 
56
+ context "with float" do
57
+ subject { Pump::Xml::Dsl.new { float :name } }
58
+ its(:config) { should eql([{:name => :name, :attributes => {:type => 'float'}, :xmlsafe => true}]) }
59
+
60
+ context "with attributes and options" do
61
+ subject { Pump::Xml::Dsl.new { float :name, :attributes => {:a => 'b'}, :options => false } }
62
+ its(:config) { should eql([{:name => :name, :attributes => {:type => 'float', :a => 'b'}, :options => false, :xmlsafe => true}]) }
63
+ end
64
+ end
65
+
66
+ context "with boolean" do
67
+ subject { Pump::Xml::Dsl.new { boolean :name } }
68
+ its(:config) { should eql([{:name => :name, :attributes => {:type => 'boolean'}, :xmlsafe => true}]) }
69
+
70
+ context "with attributes and options" do
71
+ subject { Pump::Xml::Dsl.new { boolean :name, :attributes => {:a => 'b'}, :options => false } }
72
+ its(:config) { should eql([{:name => :name, :attributes => {:type => 'boolean', :a => 'b'}, :options => false, :xmlsafe => true}]) }
73
+ end
74
+ end
75
+
56
76
  context "with date" do
57
77
  subject { Pump::Xml::Dsl.new { date :at } }
58
78
  its(:config) { should eql([{:at => :at, :attributes => {:type => 'date'}, :xmlsafe => true}]) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-12 00:00:00.000000000 Z
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport