characterizable 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -0,0 +1,60 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{characterizable}
8
+ s.version = "0.0.9"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Andy Rossmeissl", "Seamus Abshere"]
12
+ s.date = %q{2010-07-06}
13
+ s.description = %q{Characterize the relationship between "attributes" (getters/setters) of instances of a class}
14
+ s.email = %q{seamus@abshere.net}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "characterizable.gemspec",
27
+ "lib/characterizable.rb",
28
+ "test/helper.rb",
29
+ "test/test_characterizable.rb"
30
+ ]
31
+ s.homepage = %q{http://github.com/seamusabshere/characterizable}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.6}
35
+ s.summary = %q{Characterize instances of a class}
36
+ s.test_files = [
37
+ "test/helper.rb",
38
+ "test/test_characterizable.rb"
39
+ ]
40
+
41
+ if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ s.add_runtime_dependency(%q<blockenspiel>, [">= 0.3.2"])
47
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
48
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
49
+ else
50
+ s.add_dependency(%q<blockenspiel>, [">= 0.3.2"])
51
+ s.add_dependency(%q<activesupport>, [">= 2.3.5"])
52
+ s.add_dependency(%q<shoulda>, [">= 0"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<blockenspiel>, [">= 0.3.2"])
56
+ s.add_dependency(%q<activesupport>, [">= 2.3.5"])
57
+ s.add_dependency(%q<shoulda>, [">= 0"])
58
+ end
59
+ end
60
+
@@ -49,9 +49,9 @@ module Characterizable
49
49
  memo
50
50
  end
51
51
  end
52
- def slice(*keys)
52
+ def slice(*keep)
53
53
  inject(self.class.new(*survivor_args)) do |memo, ary|
54
- if keys.include?(ary[0])
54
+ if keep.include?(ary[0])
55
55
  memo[ary[0]] = ary[1]
56
56
  end
57
57
  memo
@@ -78,6 +78,13 @@ module Characterizable
78
78
  end
79
79
  end
80
80
  end
81
+ def slice(*keep)
82
+ copy = self.class.new *survivor_args
83
+ copy.keys.each do |key|
84
+ copy.delete key unless keep.include? key
85
+ end
86
+ copy
87
+ end
81
88
  def target
82
89
  survivor_args.first
83
90
  end
@@ -317,4 +317,11 @@ class TestCharacterizable < Test::Unit::TestCase
317
317
  end
318
318
  assert_equal [:bar, :foo], Fickle.characteristics.keys.sort { |a, b| a.to_s <=> b.to_s }
319
319
  end
320
+
321
+ should 'allow characterizations to be sliced' do
322
+ a = Automobile.new
323
+ a.make = 'Ford'
324
+ assert_equal({ :make => 'Ford' }, a.characteristics)
325
+ assert_equal({}, a.characteristics.slice(:dummy))
326
+ end
320
327
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andy Rossmeissl
@@ -74,6 +74,7 @@ files:
74
74
  - README.rdoc
75
75
  - Rakefile
76
76
  - VERSION
77
+ - characterizable.gemspec
77
78
  - lib/characterizable.rb
78
79
  - test/helper.rb
79
80
  - test/test_characterizable.rb