functional-ruby 0.7.5 → 0.7.6.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/functional.rb +2 -0
- data/lib/functional/behavior.rb +10 -11
- data/lib/functional/version.rb +1 -1
- data/spec/functional/behavior_spec.rb +20 -0
- data/spec/spec_helper.rb +7 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98b58fbce9e6d6496e72693ecc6c6d3c72c004d2
|
4
|
+
data.tar.gz: 750faaf59381ea52c445341e753f1f7cff038bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f5e93569a481544d1814a4d266451101467076030cbec86bf5411de182ca53306a44d185992b0b101eb4a118f139be649dc4623840dd7664c2f87e1665d0fd2
|
7
|
+
data.tar.gz: 58eb4e1e36fffe74b714f78e3600c11e2c0341268a545e910370825d2122772c00a0849318b5cdf696d30c5e1cd84cb81fd7bb3a690c7d2032e20fedaa117fd4
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Functional Ruby [![Build Status](https://secure.travis-ci.org/jdantonio/functional-ruby.png)](https://travis-ci.org/jdantonio/functional-ruby?branch=master) [![Dependency Status](https://gemnasium.com/jdantonio/functional-ruby.png)](https://gemnasium.com/jdantonio/functional-ruby)
|
1
|
+
# Functional Ruby [![Build Status](https://secure.travis-ci.org/jdantonio/functional-ruby.png)](https://travis-ci.org/jdantonio/functional-ruby?branch=master) [![Coverage Status](https://coveralls.io/repos/jdantonio/functional-ruby/badge.png)](https://coveralls.io/r/jdantonio/functional-ruby) [![Dependency Status](https://gemnasium.com/jdantonio/functional-ruby.png)](https://gemnasium.com/jdantonio/functional-ruby)
|
2
2
|
|
3
3
|
A gem for adding Erlang, Clojure, and Go inspired functional programming tools to Ruby.
|
4
4
|
|
data/lib/functional.rb
CHANGED
data/lib/functional/behavior.rb
CHANGED
@@ -56,20 +56,19 @@ module Kernel
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
clazz.behaviors
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
#end
|
59
|
+
if $ENABLE_BEHAVIOR_CHECK_ON_CONSTRUCTION == true
|
60
|
+
class << clazz
|
61
|
+
def new(*args, &block)
|
62
|
+
obj = __new(*args, &block)
|
63
|
+
self.ancestors.each do |clazz|
|
64
|
+
if clazz.respond_to?(:behaviors)
|
65
|
+
clazz.behaviors.each do |behavior|
|
66
|
+
valid = obj.behaves_as?(behavior, true)
|
67
|
+
end
|
69
68
|
end
|
70
69
|
end
|
70
|
+
return obj
|
71
71
|
end
|
72
|
-
return obj
|
73
72
|
end
|
74
73
|
end
|
75
74
|
end
|
data/lib/functional/version.rb
CHANGED
@@ -99,6 +99,26 @@ describe '-behavior' do
|
|
99
99
|
lambda{ clazz.new }.should raise_error(BehaviorError)
|
100
100
|
end
|
101
101
|
|
102
|
+
it 'allows constructor check to be permanently disabled when gem loaded' do
|
103
|
+
|
104
|
+
@original_config = $ENABLE_BEHAVIOR_CHECK_ON_CONSTRUCTION
|
105
|
+
|
106
|
+
behavior_info(:gen_foo, foo: 0)
|
107
|
+
|
108
|
+
$ENABLE_BEHAVIOR_CHECK_ON_CONSTRUCTION = true
|
109
|
+
load(File.join(File.dirname(__FILE__), '../../', 'lib/functional/behavior.rb'))
|
110
|
+
clazz = Class.new { behavior(:gen_foo) }
|
111
|
+
expect { clazz.new }.to raise_error(BehaviorError)
|
112
|
+
|
113
|
+
$ENABLE_BEHAVIOR_CHECK_ON_CONSTRUCTION = false
|
114
|
+
load(File.join(File.dirname(__FILE__), '../../', 'lib/functional/behavior.rb'))
|
115
|
+
clazz = Class.new { behavior(:gen_foo) }
|
116
|
+
expect { clazz.new }.not_to raise_error()
|
117
|
+
|
118
|
+
$ENABLE_BEHAVIOR_CHECK_ON_CONSTRUCTION = @original_config
|
119
|
+
load(File.join(File.dirname(__FILE__), '../../', 'lib/functional/behavior.rb'))
|
120
|
+
end
|
121
|
+
|
102
122
|
context 'instance methods' do
|
103
123
|
|
104
124
|
it 'raises an exception when one or more function definitions are missing' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
+
SimpleCov::Formatter::HTMLFormatter,
|
6
|
+
Coveralls::SimpleCov::Formatter
|
7
|
+
]
|
8
|
+
|
2
9
|
SimpleCov.start do
|
3
10
|
project_name 'functional-ruby'
|
4
11
|
add_filter '/md/'
|
@@ -23,5 +30,4 @@ RSpec.configure do |config|
|
|
23
30
|
|
24
31
|
config.after(:each) do
|
25
32
|
end
|
26
|
-
|
27
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: functional-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerry D'Antonio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,12 +92,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: 1.9.2
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - '
|
95
|
+
- - '>'
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
97
|
+
version: 1.3.1
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
100
|
+
rubygems_version: 2.1.5
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: Erlang and Clojure inspired functional programming tools for Ruby.
|