simple-masker 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile CHANGED
@@ -6,9 +6,9 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- # gem "shoulda", ">= 0"
10
- gem "rdoc", "~> 3.12"
11
- gem "bundler", "~> 1.2"
12
- gem "jeweler", "~> 1.8.4"
13
- # gem "rcov", ">= 0"
9
+ gem "rdoc"
10
+ gem "bundler"
11
+ gem "jeweler"
12
+ gem "rspec"
13
+ gem "shoulda"
14
14
  end
data/Gemfile.lock CHANGED
@@ -1,21 +1,49 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ activesupport (3.2.13)
5
+ i18n (= 0.6.1)
6
+ multi_json (~> 1.0)
7
+ bourne (1.4.0)
8
+ mocha (~> 0.13.2)
9
+ diff-lcs (1.2.3)
4
10
  git (1.2.5)
11
+ i18n (0.6.1)
5
12
  jeweler (1.8.4)
6
13
  bundler (~> 1.0)
7
14
  git (>= 1.2.5)
8
15
  rake
9
16
  rdoc
10
17
  json (1.7.7)
18
+ metaclass (0.0.1)
19
+ mocha (0.13.3)
20
+ metaclass (~> 0.0.1)
21
+ multi_json (1.7.2)
11
22
  rake (10.0.4)
12
- rdoc (3.12.2)
23
+ rdoc (4.0.1)
13
24
  json (~> 1.4)
25
+ rspec (2.13.0)
26
+ rspec-core (~> 2.13.0)
27
+ rspec-expectations (~> 2.13.0)
28
+ rspec-mocks (~> 2.13.0)
29
+ rspec-core (2.13.1)
30
+ rspec-expectations (2.13.0)
31
+ diff-lcs (>= 1.1.3, < 2.0)
32
+ rspec-mocks (2.13.1)
33
+ shoulda (3.4.0)
34
+ shoulda-context (~> 1.0, >= 1.0.1)
35
+ shoulda-matchers (~> 1.0, >= 1.4.1)
36
+ shoulda-context (1.1.0)
37
+ shoulda-matchers (1.5.6)
38
+ activesupport (>= 3.0.0)
39
+ bourne (~> 1.3)
14
40
 
15
41
  PLATFORMS
16
42
  ruby
17
43
 
18
44
  DEPENDENCIES
19
- bundler (~> 1.2)
20
- jeweler (~> 1.8.4)
21
- rdoc (~> 3.12)
45
+ bundler
46
+ jeweler
47
+ rdoc
48
+ rspec
49
+ shoulda
data/README.md CHANGED
@@ -1,4 +1,19 @@
1
1
  simple-masker
2
2
  =============
3
3
 
4
- An implementation of presenter pattern.
4
+ An implementation of presenter pattern.
5
+
6
+ == Contributing to simple-masker
7
+
8
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
9
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
10
+ * Fork the project.
11
+ * Start a feature/bugfix branch.
12
+ * Commit and push until you are happy with your contribution.
13
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
14
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
15
+
16
+ == Copyright
17
+
18
+ Copyright (c) 2013 MoreRon. See LICENSE.txt for
19
+ further details.
data/Rakefile CHANGED
@@ -32,14 +32,6 @@ Rake::TestTask.new(:test) do |test|
32
32
  test.verbose = true
33
33
  end
34
34
 
35
- # require 'rcov/rcovtask'
36
- # Rcov::RcovTask.new do |test|
37
- # test.libs << 'test'
38
- # test.pattern = 'test/**/test_*.rb'
39
- # test.verbose = true
40
- # test.rcov_opts << '--exclude "gems/*"'
41
- # end
42
-
43
35
  task :default => :test
44
36
 
45
37
  require 'rdoc/task'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/lib/simple-masker.rb CHANGED
@@ -1,9 +1,13 @@
1
+ require "forwardable"
2
+
1
3
  # A simple implementation of a presenter pattern.
2
4
  # Acts like a SimpleDelegator implementing a decorator pattern except that
3
5
  # it hides the object's methods instead of delegating them by default.
4
6
  # Useful for hiding the ugly beast behind the mask.
5
7
 
6
8
  class SimpleMasker
9
+ extend Forwardable
10
+
7
11
  def initialize(object)
8
12
  _set_masked_object object
9
13
  end
@@ -13,9 +17,7 @@ class SimpleMasker
13
17
  end
14
18
 
15
19
  def self.reveal_method(*method_names)
16
- method_names.each do |method_name|
17
- delegate method_name, :to => :_get_masked_object
18
- end
20
+ def_delegators :_get_masked_object, *method_names
19
21
  end
20
22
 
21
23
  def _get_masked_object
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{simple-masker}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["MoreRon"]
12
+ s.date = %q{2013-04-12}
13
+ s.description = %q{Acts like a SimpleDelegator implementing a decorator pattern except that it hides the object's methods instead of delegating them by default. Useful for hiding the ugly beast behind the mask.}
14
+ s.email = %q{more.ron.too@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".rspec",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/simple-masker.rb",
28
+ "simple-masker.gemspec",
29
+ "spec/simple-masker_spec.rb",
30
+ "spec/spec_helper.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/more-ron/simple-masker}
33
+ s.licenses = ["MIT"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.6}
36
+ s.summary = %q{A simple implementation of a presenter pattern}
37
+
38
+ if s.respond_to? :specification_version then
39
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
40
+ s.specification_version = 3
41
+
42
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
43
+ s.add_development_dependency(%q<rdoc>, [">= 0"])
44
+ s.add_development_dependency(%q<bundler>, [">= 0"])
45
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
46
+ s.add_development_dependency(%q<rspec>, [">= 0"])
47
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<rdoc>, [">= 0"])
50
+ s.add_dependency(%q<bundler>, [">= 0"])
51
+ s.add_dependency(%q<jeweler>, [">= 0"])
52
+ s.add_dependency(%q<rspec>, [">= 0"])
53
+ s.add_dependency(%q<shoulda>, [">= 0"])
54
+ end
55
+ else
56
+ s.add_dependency(%q<rdoc>, [">= 0"])
57
+ s.add_dependency(%q<bundler>, [">= 0"])
58
+ s.add_dependency(%q<jeweler>, [">= 0"])
59
+ s.add_dependency(%q<rspec>, [">= 0"])
60
+ s.add_dependency(%q<shoulda>, [">= 0"])
61
+ end
62
+ end
63
+
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ module SimpleMasker::Tests
4
+ describe SimpleMasker do
5
+
6
+ class UglyBeast
7
+ def presentable?
8
+ end
9
+
10
+ def ugly?
11
+ end
12
+ end
13
+
14
+ class MaskedMan < SimpleMasker
15
+ masks :ugly_beast
16
+
17
+ reveal_method :presentable?
18
+ end
19
+
20
+ let(:ugly_beast){ UglyBeast.new }
21
+
22
+ subject(:masked_man) do
23
+ MaskedMan.new ugly_beast
24
+ end
25
+
26
+ describe ".hides" do
27
+ it "identifies what's masked" do
28
+ masked_man.ugly_beast == ugly_beast
29
+ end
30
+ end
31
+
32
+ describe ".reveal_method" do
33
+ it "reveals the specified method" do
34
+ masked_man.should respond_to :presentable?
35
+ end
36
+
37
+ it "does not reveal other methods" do
38
+ masked_man.should_not respond_to :ugly?
39
+ end
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,20 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+
8
+ require "simple-masker"
9
+
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ config.filter_run :focus
14
+
15
+ # Run specs in random order to surface order dependencies. If you find an
16
+ # order dependency and want to debug it, you can fix the order by providing
17
+ # the seed, which is printed after each run.
18
+ # --seed 1234
19
+ config.order = 'random'
20
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - MoreRon
@@ -23,12 +23,11 @@ dependencies:
23
23
  name: rdoc
24
24
  version_requirements: &id001 !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  segments:
29
- - 3
30
- - 12
31
- version: "3.12"
29
+ - 0
30
+ version: "0"
32
31
  requirement: *id001
33
32
  - !ruby/object:Gem::Dependency
34
33
  prerelease: false
@@ -36,12 +35,11 @@ dependencies:
36
35
  name: bundler
37
36
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
37
  requirements:
39
- - - ~>
38
+ - - ">="
40
39
  - !ruby/object:Gem::Version
41
40
  segments:
42
- - 1
43
- - 2
44
- version: "1.2"
41
+ - 0
42
+ version: "0"
45
43
  requirement: *id002
46
44
  - !ruby/object:Gem::Dependency
47
45
  prerelease: false
@@ -49,14 +47,36 @@ dependencies:
49
47
  name: jeweler
50
48
  version_requirements: &id003 !ruby/object:Gem::Requirement
51
49
  requirements:
52
- - - ~>
50
+ - - ">="
53
51
  - !ruby/object:Gem::Version
54
52
  segments:
55
- - 1
56
- - 8
57
- - 4
58
- version: 1.8.4
53
+ - 0
54
+ version: "0"
59
55
  requirement: *id003
56
+ - !ruby/object:Gem::Dependency
57
+ prerelease: false
58
+ type: :development
59
+ name: rspec
60
+ version_requirements: &id004 !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ requirement: *id004
68
+ - !ruby/object:Gem::Dependency
69
+ prerelease: false
70
+ type: :development
71
+ name: shoulda
72
+ version_requirements: &id005 !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirement: *id005
60
80
  description: Acts like a SimpleDelegator implementing a decorator pattern except that it hides the object's methods instead of delegating them by default. Useful for hiding the ugly beast behind the mask.
61
81
  email: more.ron.too@gmail.com
62
82
  executables: []
@@ -66,18 +86,18 @@ extensions: []
66
86
  extra_rdoc_files:
67
87
  - LICENSE.txt
68
88
  - README.md
69
- - README.rdoc
70
89
  files:
90
+ - .rspec
71
91
  - Gemfile
72
92
  - Gemfile.lock
73
93
  - LICENSE.txt
74
94
  - README.md
75
- - README.rdoc
76
95
  - Rakefile
77
96
  - VERSION
78
97
  - lib/simple-masker.rb
79
- - test/helper.rb
80
- - test/test_simple-masker.rb
98
+ - simple-masker.gemspec
99
+ - spec/simple-masker_spec.rb
100
+ - spec/spec_helper.rb
81
101
  has_rdoc: true
82
102
  homepage: http://github.com/more-ron/simple-masker
83
103
  licenses:
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = simple-masker
2
-
3
- Description goes here.
4
-
5
- == Contributing to simple-masker
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2013 MoreRon. See LICENSE.txt for
18
- further details.
19
-
data/test/helper.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'simple-masker'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestSimpleMasker < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end