wendy 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ /.bundle
2
+ /log/*.log
3
+ /tmp
4
+ /tags
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in otb_mongo_gem.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "rake"
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wendy (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.1.3)
10
+ rake (10.0.2)
11
+ rspec (2.12.0)
12
+ rspec-core (~> 2.12.0)
13
+ rspec-expectations (~> 2.12.0)
14
+ rspec-mocks (~> 2.12.0)
15
+ rspec-core (2.12.1)
16
+ rspec-expectations (2.12.0)
17
+ diff-lcs (~> 1.1.3)
18
+ rspec-mocks (2.12.0)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ rake
25
+ rspec
26
+ wendy!
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/_license ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Russell Dunphy
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/lib/wendy.rb ADDED
@@ -0,0 +1,29 @@
1
+ module Wendy
2
+
3
+ def wend(arg)
4
+ Wender.new(self, arg)
5
+ end
6
+
7
+ class Wender
8
+
9
+ def initialize(initiator, arg)
10
+ @initiator = initiator
11
+ @arg = arg
12
+ end
13
+
14
+ def through(method)
15
+ Wender.new(initiator, initiator.send(method, arg))
16
+ end
17
+
18
+ def result
19
+ arg
20
+ end
21
+
22
+ alias_method :and, :through
23
+ alias_method :and_return, :result
24
+
25
+ private
26
+ attr_reader :initiator, :arg
27
+ end
28
+
29
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ class TestWender
4
+ include Wendy
5
+
6
+ def square(x)
7
+ x * x
8
+ end
9
+
10
+ def double(x)
11
+ x + x
12
+ end
13
+
14
+ def wend_test
15
+ wend(5).through(:square).and(:double).and_return
16
+ end
17
+
18
+ end
19
+
20
+ describe Wendy do
21
+
22
+ it 'allows method chaining' do
23
+ TestWender.new.wend_test.should eq 50
24
+ end
25
+
26
+ end
@@ -0,0 +1,8 @@
1
+ require 'rspec'
2
+ require 'wendy'
3
+
4
+ RSpec.configure do |config|
5
+ config.order = :rand
6
+ config.color_enabled = true
7
+ end
8
+
data/wendy.gemspec ADDED
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |gem|
3
+ gem.authors = ["Russell Dunphy"]
4
+ gem.email = ["russell@rsslldnphy.com"]
5
+ gem.description = %q{Provides a nice way of chaining methods.}
6
+ gem.summary = gem.description
7
+ gem.homepage = "http://github.com/rsslldnphy/wendy"
8
+
9
+ gem.add_development_dependency 'rspec'
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "wendy"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = "0.0.1"
17
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wendy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Russell Dunphy
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Provides a nice way of chaining methods.
31
+ email:
32
+ - russell@rsslldnphy.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - Gemfile.lock
40
+ - Rakefile
41
+ - _license
42
+ - lib/wendy.rb
43
+ - spec/lib/wendy_spec.rb
44
+ - spec/spec_helper.rb
45
+ - wendy.gemspec
46
+ homepage: http://github.com/rsslldnphy/wendy
47
+ licenses: []
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 1.8.24
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Provides a nice way of chaining methods.
70
+ test_files:
71
+ - spec/lib/wendy_spec.rb
72
+ - spec/spec_helper.rb
73
+ has_rdoc: