id 0.0.3 → 0.0.4

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/Gemfile.lock CHANGED
@@ -1,16 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- id (0.0.2)
5
- active_support
4
+ id (0.0.3)
5
+ activesupport
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- active_support (3.0.0)
11
- activesupport (= 3.0.0)
12
- activesupport (3.0.0)
10
+ activesupport (3.2.11)
11
+ i18n (~> 0.6)
12
+ multi_json (~> 1.0)
13
13
  diff-lcs (1.2.1)
14
+ i18n (0.6.1)
14
15
  multi_json (1.7.2)
15
16
  rspec (2.13.0)
16
17
  rspec-core (~> 2.13.0)
data/id.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'id'
3
- s.version = '0.0.3'
3
+ s.version = '0.0.4'
4
4
  s.date = '2013-03-28'
5
5
  s.summary = "Simple models based on hashes"
6
6
  s.description = "Developed at On The Beach Ltd. Contact russell.dunphy@onthebeach.co.uk"
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.files = `git ls-files`.split($\)
10
10
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
11
11
  s.require_paths = ["lib"]
12
- s.homepage = 'http://rubygems.org/gems/id'
12
+ s.homepage = 'http://github.com/onthebeach/id'
13
13
 
14
14
  s.add_dependency "activesupport"
15
15
 
data/lib/id/model.rb CHANGED
@@ -6,6 +6,10 @@ module Id
6
6
  @data = Hash[data.map { |k, v| [k.to_s, v] }]
7
7
  end
8
8
 
9
+ def set(values)
10
+ self.class.new(data.merge(values))
11
+ end
12
+
9
13
  private
10
14
 
11
15
  def self.included(base)
data/spec/lib/id_spec.rb CHANGED
@@ -72,5 +72,13 @@ describe Id::Model do
72
72
  model.nested_models.last.yak.should eq 14
73
73
  end
74
74
  end
75
+
76
+ describe "#set" do
77
+ it "creates a new model with the provided values changed" do
78
+ model.set(foo: 999).should be_a TestModel
79
+ model.set(foo: 999).foo.should eq 999
80
+ end
81
+ end
82
+
75
83
  end
76
84
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -89,7 +89,7 @@ files:
89
89
  - spec/lib/id/model_spec.rb
90
90
  - spec/lib/id_spec.rb
91
91
  - spec/spec_helper.rb
92
- homepage: http://rubygems.org/gems/id
92
+ homepage: http://github.com/onthebeach/id
93
93
  licenses: []
94
94
  post_install_message:
95
95
  rdoc_options: []