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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97e8113fb43fd8fda7f581f0e3bc342e66b42cdb
4
- data.tar.gz: c64e9d6a0788814d50bdc87b00ca7d00caa887a5
3
+ metadata.gz: 98b58fbce9e6d6496e72693ecc6c6d3c72c004d2
4
+ data.tar.gz: 750faaf59381ea52c445341e753f1f7cff038bac
5
5
  SHA512:
6
- metadata.gz: ac1e57dac94eedaf8a94a45715ecc5757238afa8a7fe4dc24e57b3255d1ce7f1e64a3b2d562c099d0b77ca1b815778905ad561c09e46c337c1b43c0e4c4188f2
7
- data.tar.gz: 4db984862cf3b281ed4251e4fd1d6f8702e015f47a348d091080f84df0479cdc3fa77ecc2eafb0c64801c7e7d8a58ca8d7a3f1dd8ef7e1006359f02e498f94d6
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
 
@@ -13,6 +13,8 @@ require 'functional/version'
13
13
  Infinity = 1/0.0 unless defined?(Infinity)
14
14
  NaN = 0/0.0 unless defined?(NaN)
15
15
 
16
+ $ENABLE_BEHAVIOR_CHECK_ON_CONSTRUCTION ||= true
17
+
16
18
  module Functional
17
19
 
18
20
  class << self
@@ -56,20 +56,19 @@ module Kernel
56
56
  end
57
57
  end
58
58
 
59
- class << clazz
60
- def new(*args, &block)
61
- obj = __new(*args, &block)
62
- self.ancestors.each do |clazz|
63
- if clazz.respond_to?(:behaviors)
64
- clazz.behaviors.each do |behavior|
65
- valid = obj.behaves_as?(behavior, true)
66
- #unless obj.behaves_as?(behavior)
67
- #raise BehaviorError.new("undefined callback functions in #{self} (behavior '#{behavior}')")
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
@@ -1,3 +1,3 @@
1
1
  module Functional
2
- VERSION = '0.7.5'
2
+ VERSION = '0.7.6.pre.1'
3
3
  end
@@ -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
@@ -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.5
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-08-20 00:00:00.000000000 Z
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: '0'
97
+ version: 1.3.1
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 2.0.6
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.