attribution 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs = ["lib"]
6
+ t.test_files = FileList["test/*_test.rb"]
7
+ end
8
+
9
+ task :default => :test
data/attribution.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "attribution"
5
- gem.version = "0.0.1"
5
+ gem.version = "0.0.2"
6
6
  gem.authors = ["Paul Barry"]
7
7
  gem.email = ["mail@paulbarry.com"]
8
8
  gem.description = %q{Add attributes to Ruby objects}
data/lib/attribution.rb CHANGED
@@ -11,7 +11,12 @@ module Attribution
11
11
  def initialize(attrs={})
12
12
  attrs = JSON.parse(attrs) if attrs.is_a?(String)
13
13
  attrs.each do |k,v|
14
- send("#{k}=", v)
14
+ setter = "#{k}="
15
+ if respond_to?(setter)
16
+ send(setter, v)
17
+ else
18
+ instance_variable_set("@#{k}", v)
19
+ end
15
20
  end
16
21
  end
17
22
 
@@ -1,3 +1,3 @@
1
1
  module Attribution
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -59,10 +59,6 @@ class AttributionTest < Test::Unit::TestCase
59
59
  ]
60
60
  }
61
61
 
62
- puts JSON.pretty_generate(data)
63
-
64
- puts data.to_json.inspect
65
-
66
62
  book = Book.new(data.to_json)
67
63
 
68
64
  assert_equal 1, book.id
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attribution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-20 00:00:00.000000000 Z
12
+ date: 2013-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport