funcionalist 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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjczZjM1YzY4MjM1ZjdjZjU5NTM3MGFiNWQxODcxYjkyNjRmOWIzYg==
5
+ data.tar.gz: !binary |-
6
+ OTgyYTAwOGZkYmYxYjk2OGQ0MTc2ZjVlNDdjNTgxZWVhZGVhMjRkYw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OTU3YzRjZjQ1NTU0NDRmMjA0MWEwOGZjZDExMWY1NzJmMzg4Y2UzZmQwODZh
10
+ YTg5ZjZiM2ZjNjM2ZjhlMzcxNWVhN2IwNDRlZTNjNTU0ZDQyNGJkODQ3NzQ1
11
+ ZGZkMTViMjE3MzRjYmRmZjQyZjZmZmM3ZmE1MWRjNmVhZWUxM2M=
12
+ data.tar.gz: !binary |-
13
+ ZjI4YWZmNzljY2U0ZTEyYzgyZWVkY2I0ZGM5ZWQ5MWE1YmFjNDVjMzQwOTA5
14
+ MjcyYTdmMmZiYzE2MWIxNDMzY2E5ZmEzMDNiZWY2MzEzZDY1Y2MyOTQxNmEx
15
+ NzkwMDcwNTA4MjdmMTY2NmRjNDU4OWYxNjA2YmM1YmE3NjFkNDA=
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## Funcionalist 0.0.1 (Aug 29, 2014) ##
2
+
3
+ * No changes.
4
+
5
+
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Miguel Regedor
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,8 @@
1
+ module Kernel
2
+ protected
3
+
4
+ def point_free
5
+ Funcionalist::PointFree::Expression.new
6
+ end
7
+
8
+ end
@@ -0,0 +1,9 @@
1
+ $: << File.expand_path(File.dirname(__FILE__))
2
+
3
+ require 'funcionalist/version'
4
+ require 'funcionalist/point_free'
5
+ require 'funcionalist/point_free/operator'
6
+ require 'funcionalist/point_free/expression'
7
+
8
+ require 'core_ext/kernel'
9
+
@@ -0,0 +1 @@
1
+ module PointFree ; end
@@ -0,0 +1,39 @@
1
+ module Funcionalist
2
+ module PointFree
3
+ class Expression
4
+
5
+ undef_method(*(instance_methods.map(&:to_sym) - [:__id__, :__send__, :object_id]))
6
+
7
+
8
+ def initialize
9
+ @methods = []
10
+ end
11
+
12
+ def _(reciever)
13
+ self.funcionalist_point_free_change_reciever(reciever)
14
+ end
15
+
16
+
17
+ def method_missing(*method_and_args, &block)
18
+ @methods << [method_and_args, block] unless method_and_args == [:respond_to?, :to_proc]
19
+ self
20
+ end
21
+
22
+
23
+ def to_proc
24
+ lambda do |obj|
25
+ reciever, value = @methods.inject(obj) do |left, right|
26
+ Funcionalist::PointFree::Operator.caculate(left, right)
27
+ end
28
+ reciever
29
+ end
30
+ end
31
+
32
+ def queue
33
+ @methods
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+
@@ -0,0 +1,33 @@
1
+ module Funcionalist
2
+ module PointFree
3
+ module Operator
4
+
5
+ #PREFIX = 'funcionalist_point_free_'
6
+ #VALID = [:change_reciever]
7
+
8
+
9
+ def self.caculate(left, right)
10
+ reciever, value = left
11
+ method_and_args, block = right
12
+
13
+ puts "#{reciever.inspect} >> ##{method_and_args}"
14
+
15
+ a = case method_and_args.first
16
+ when :funcionalist_point_free_change_reciever
17
+ [method_and_args[1],reciever]
18
+
19
+ else #funcionalist_point_free_concat
20
+ method_and_args = [method_and_args[0]] + [value] if value
21
+
22
+ [reciever.send(*method_and_args, &block), nil]
23
+
24
+ end
25
+
26
+ puts a.inspect ;puts
27
+ return a
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,5 @@
1
+ module Funcionalist
2
+
3
+ VERSION = '0.0.1'
4
+
5
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: funcionalist
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Miguel Regedor
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The beauty of functional programing in ruby!
14
+ email: miguelregedor@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - CHANGELOG.md
20
+ - MIT-LICENSE
21
+ - lib/core_ext/kernel.rb
22
+ - lib/funcionalist/point_free/expression.rb
23
+ - lib/funcionalist/point_free/operator.rb
24
+ - lib/funcionalist/point_free.rb
25
+ - lib/funcionalist/version.rb
26
+ - lib/funcionalist.rb
27
+ homepage: http://rubygems.org/gems/funcionalist
28
+ licenses:
29
+ - MIT
30
+ metadata: {}
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: 1.9.3
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubyforge_project:
47
+ rubygems_version: 2.0.14
48
+ signing_key:
49
+ specification_version: 4
50
+ summary: The beauty of functional programing in ruby!
51
+ test_files: []