ruby-duration 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
@@ -11,6 +11,8 @@ class Duration
11
11
  def self.set(args)
12
12
  return if args.blank?
13
13
  if args.is_a?(Hash)
14
+ args.delete_if{|k, v| v.blank? || !Duration::UNITS.include?(k.to_sym)}
15
+ return if args.blank?
14
16
  Duration.new(args).to_i
15
17
  elsif args.respond_to?(:to_i)
16
18
  args.to_i
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruby-duration}
8
- s.version = "0.1.7"
8
+ s.version = "0.1.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jose Peleteiro"]
@@ -16,6 +16,9 @@ class Duration::TestMongoid < MiniTest::Unit::TestCase
16
16
  assert_nil Duration.set([1,2,3])
17
17
  assert_nil Duration.set(nil)
18
18
  assert_nil Duration.set("")
19
+ assert_nil Duration.set({})
20
+ assert_nil Duration.set({:seconds => "", :hours => ""})
21
+ assert_nil Duration.set({:x => 100, :seconds => ""})
19
22
  end
20
23
 
21
24
  def test_set_duration
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-duration
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 7
10
- version: 0.1.7
9
+ - 8
10
+ version: 0.1.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jose Peleteiro