lambda_driver 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  vendor/
19
+ .rbenv-version
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # LambdaDriver
1
+ # LambdaDriver [![Build Status](https://travis-ci.org/yuroyoro/lambda_driver.png)](https://travis-ci.org/yuroyoro/lambda_driver)
2
2
 
3
3
  虚弦斥力場生成システム
4
4
 
@@ -17,6 +17,9 @@ LambdaDriver drives your code more functional.
17
17
  [:foo, :hoge, :bar, :fuga].select(&:to_s >> :length >> 3._(:<)) # => [:hoge, :fuga]
18
18
  ```
19
19
 
20
+ - [project page](http://yuroyoro.github.com/lambda_driver/)
21
+ - [rubygems.org](https://rubygems.org/gems/lambda_driver)
22
+
20
23
  ## Installation
21
24
 
22
25
  Add this line to your application's Gemfile:
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["ozaki@yuroyoro.com"]
11
11
  gem.description = %q{Drives your code more functioal!}
12
12
  gem.summary = %q{Drives your code more functioal!}
13
- gem.homepage = ""
13
+ gem.homepage = "http://yuroyoro.github.com/lambda_driver/"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -1,7 +1,7 @@
1
1
  module LambdaDriver::Currying
2
- def curry
2
+ def curry(arity = nil)
3
3
  f = self.to_proc
4
- arity = __arity(f)
4
+ arity ||= __arity(f)
5
5
  return f if arity == 0
6
6
 
7
7
  lambda{|arg| __curry(f, arity, arg, []) }
@@ -1,7 +1,7 @@
1
1
  module LambdaDriver::Disjunction
2
2
  def disjunction(f = nil, &block)
3
3
  if f.nil? && (not block_given?)
4
- return lambda{|g=nil,&inner_block| self.disjunction(g, &inner_block) }
4
+ return self.method(:disjunction)
5
5
  end
6
6
 
7
7
  (block_given? ? (yield self) : f.call(self)) || self
@@ -1,7 +1,7 @@
1
1
  module LambdaDriver::Revapply
2
2
  def revapply(f = nil, &block)
3
3
  if f.nil? && (not block_given?)
4
- return lambda{|g=nil,&inner_block| self.revapply(g, &inner_block) }
4
+ return self.method(:revapply)
5
5
  end
6
6
 
7
7
  block_given? ? (yield self) : f.call(self)
@@ -1,3 +1,3 @@
1
1
  module LambdaDriver
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -9,7 +9,7 @@ describe LambdaDriver::Disjunction do
9
9
  context 'given none' do
10
10
  subject { obj.disjunction }
11
11
 
12
- it { should be_a_kind_of Proc }
12
+ it { should be_a_kind_of Method }
13
13
 
14
14
  it('obj.disjunction.call(f) should be obj'){
15
15
  subject.call(lambda{|x| nil}).should == obj
@@ -45,7 +45,7 @@ describe LambdaDriver::Disjunction do
45
45
  context 'given none' do
46
46
  subject { obj.disjunction }
47
47
 
48
- it { should be_a_kind_of Proc }
48
+ it { should be_a_kind_of Method }
49
49
 
50
50
  it('obj.disjunction.call(f) should be obj'){
51
51
  subject.call(f).should == f.call(obj)
@@ -8,7 +8,7 @@ describe LambdaDriver::Revapply do
8
8
  context 'given none' do
9
9
  subject { object.revapply }
10
10
 
11
- it { should be_a_kind_of Proc }
11
+ it { should be_a_kind_of Method }
12
12
  it('obj.revapply.call(f) should be f.call(obj)'){
13
13
  subject.call(f).should == f.call(object)
14
14
  }
@@ -182,12 +182,20 @@ shared_examples_for 'aliases' do
182
182
  }
183
183
  end
184
184
 
185
+ # require 'lambda_driver'
186
+ # x, y, g = [:foo, 12, lambda{|x| (x.to_s * 2).to_s + "_g" }]
187
+ # subject = Proc.new{|*x| x]
188
+
185
189
  shared_examples_for 'aliases(varargs)' do
186
190
  let(:x) { :foo }
187
191
  let(:y) { 12 }
188
192
  let(:g) { lambda{|x| (x.to_s * 2).to_s + "_g" } }
189
193
 
190
- it('(f % 2 * y << g < x) should be f.curry(2).with_args(y).compose(g).call(x)'){
191
- (subject % 2 * y << g < x).should == subject.curry(2).with_args(y).compose(g).call(x)
194
+ it('(f % 2 * y << g < x) should be f.curry(2).compose(g).call(x)'){
195
+ ((subject % 2 < y) << g < x).should == subject.curry(2).call(y).compose(g).call(x)
196
+ }
197
+
198
+ it('(f.flip(2) * y << g < x) should be f.flip(2).compose(g).call(x)'){
199
+ ((subject.flip(2) < y) << g < x).should == subject.flip(2).call(y).compose(g).call(x)
192
200
  }
193
201
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambda_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-03-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70294430507480 !ruby/object:Gem::Requirement
16
+ requirement: &70234094961220 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70294430507480
24
+ version_requirements: *70234094961220
25
25
  description: Drives your code more functioal!
26
26
  email:
27
27
  - ozaki@yuroyoro.com
@@ -31,6 +31,7 @@ extra_rdoc_files: []
31
31
  files:
32
32
  - .gitignore
33
33
  - .rspec
34
+ - .travis.yml
34
35
  - Gemfile
35
36
  - LICENSE.txt
36
37
  - README.md
@@ -61,7 +62,7 @@ files:
61
62
  - spec/spec_helper.rb
62
63
  - spec/symbol_spec.rb
63
64
  - spec/unbound_method_spec.rb
64
- homepage: ''
65
+ homepage: http://yuroyoro.github.com/lambda_driver/
65
66
  licenses: []
66
67
  post_install_message:
67
68
  rdoc_options: []
@@ -73,12 +74,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
74
  - - ! '>='
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0'
77
+ segments:
78
+ - 0
79
+ hash: 926401567287214801
76
80
  required_rubygems_version: !ruby/object:Gem::Requirement
77
81
  none: false
78
82
  requirements:
79
83
  - - ! '>='
80
84
  - !ruby/object:Gem::Version
81
85
  version: '0'
86
+ segments:
87
+ - 0
88
+ hash: 926401567287214801
82
89
  requirements: []
83
90
  rubyforge_project:
84
91
  rubygems_version: 1.8.10