fp_rb 0.1.0 → 0.2.0

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: 5706073ecf19c99490a1633ab79d73b4483a4b4a
4
- data.tar.gz: a484678a0688c45d9956d2b636413327d6b559de
3
+ metadata.gz: 1be61e229ee71c120b653342672b6caf5b7efac3
4
+ data.tar.gz: 4410e0e74838669916f26085919896b8cf2ac5bb
5
5
  SHA512:
6
- metadata.gz: 6d63df015e65035e1f180715032019de8aefe2bcc0b7d8605317d8f1379c1c7e569c6c3d3967b843271b93906fa6d10c588ceb20a0858c1ef5831e2476e17eeb
7
- data.tar.gz: ddbbc0b7cef5b999dc0fefd201ee74e76fa40c54c89aa7fa4070ece2656324231c0bb504f6f093b433435668e91fab6c61ceff044f0d86bf5347cdbdd03b538c
6
+ metadata.gz: c43c2abb14e1a55ad11fbbb47430282c0b9b5c06f7df7c8220fcf76dc9c61c5d147e1745e6519824f7b93e21b667fcc20d8f557b705903ebddd9757ac49bb710
7
+ data.tar.gz: 053fc2cdc5eccf3639573bfded0f267da5355d3e211abdf1712e4c290860889197cf9ca84f1892d09cbb45a6501a040277b258fc8dcb5e2c55bb513426dd1d9c
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ Style/StabbyLambdaParentheses:
2
+ Enabled: false
3
+
data/fp_rb.gemspec CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_runtime_dependency "superators19", "~>0.9.3"
25
- spec.add_runtime_dependency "activesupport"
26
25
  spec.add_development_dependency "bundler", "~> 1.14"
27
26
  spec.add_development_dependency "rake", "~> 10.0"
28
27
  spec.add_development_dependency "minitest", "~> 5.0"
data/lib/fp_rb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FpRb
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/fp_rb.rb CHANGED
@@ -3,11 +3,36 @@ require "fp_rb/version"
3
3
  require 'fp_rb/operator'
4
4
  require 'fp_rb/maybe'
5
5
  require 'fp_rb/result'
6
- require 'active_support/core_ext/module/attribute_accessors'
6
+
7
+ class Module
8
+ # stolen from Rails mattr_accessor
9
+ def def_fn(*syms, instance_reader: true, instance_accessor: true, default: nil)
10
+ syms.each do |sym|
11
+ raise NameError.new("invalid attribute name: #{sym}") unless (sym =~ /\A[_A-Za-z]\w*\z/)
12
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
13
+ @@#{sym} = nil unless defined? @@#{sym}
14
+ def self.#{sym}
15
+ @@#{sym}
16
+ end
17
+ EOS
18
+
19
+ if instance_reader && instance_accessor
20
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
21
+ def #{sym}
22
+ @@#{sym}
23
+ end
24
+ EOS
25
+ end
26
+
27
+ sym_default_value = (block_given? && default.nil?) ? yield : default
28
+ class_variable_set("@@#{sym}", sym_default_value) unless sym_default_value.nil?
29
+ end
30
+ end
31
+ end
7
32
 
8
33
  module FpRb
9
- mattr_reader :and_then
34
+ def_fn :and_then
10
35
 
11
- @@and_then = -> f, a { a.and_then(f) }.curry
12
- @@map = -> f, a { a.map(f) }.curry
36
+ @@and_then = ->f, a { a.and_then(f) }.curry
37
+ @@map = ->f, a { a.map(f) }.curry
13
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fp_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Chabot
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: superators19
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.9.3
27
- - !ruby/object:Gem::Dependency
28
- name: activesupport
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -88,6 +74,7 @@ extensions: []
88
74
  extra_rdoc_files: []
89
75
  files:
90
76
  - ".gitignore"
77
+ - ".rubocop.yml"
91
78
  - ".travis.yml"
92
79
  - CODE_OF_CONDUCT.md
93
80
  - Gemfile