iolite 0.0.3 → 2.0.0

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.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. metadata +17 -122
  3. data/.gitignore +0 -24
  4. data/.rspec +0 -2
  5. data/.travis.yml +0 -5
  6. data/Gemfile +0 -4
  7. data/LICENSE.txt +0 -22
  8. data/README.md +0 -88
  9. data/Rakefile +0 -7
  10. data/docs/iolite.md +0 -314
  11. data/docs/release_note.md +0 -15
  12. data/example/array.rb +0 -17
  13. data/example/compare_lambda_driver.rb +0 -78
  14. data/example/fizzbuzz.rb +0 -15
  15. data/example/hash.rb +0 -14
  16. data/example/lazy_list.rb +0 -14
  17. data/example/minimal_implement.rb +0 -42
  18. data/example/simple.rb +0 -46
  19. data/example/to_lazy.rb +0 -37
  20. data/iolite.gemspec +0 -24
  21. data/lib/iolite/adaptor/all.rb +0 -22
  22. data/lib/iolite/adaptor/apply.rb +0 -10
  23. data/lib/iolite/adaptor/bind.rb +0 -9
  24. data/lib/iolite/adaptor/callable.rb +0 -7
  25. data/lib/iolite/adaptor/define_send_original_methods.rb +0 -12
  26. data/lib/iolite/adaptor/method_missing.rb +0 -10
  27. data/lib/iolite/adaptor/operators.rb +0 -26
  28. data/lib/iolite/adaptor/send.rb +0 -11
  29. data/lib/iolite/adaptor/to_lazy.rb +0 -11
  30. data/lib/iolite/adaptor/to_proc.rb +0 -10
  31. data/lib/iolite/adaptor.rb +0 -2
  32. data/lib/iolite/adaptored/array.rb +0 -12
  33. data/lib/iolite/adaptored/hash.rb +0 -14
  34. data/lib/iolite/adaptored/iolite_lazy_with_hash.rb +0 -7
  35. data/lib/iolite/adaptored/object_with_to_lazy.rb +0 -5
  36. data/lib/iolite/adaptored/proc.rb +0 -5
  37. data/lib/iolite/adaptored/proc_with_callable.rb +0 -5
  38. data/lib/iolite/adaptored/string.rb +0 -21
  39. data/lib/iolite/functinal/bind.rb +0 -12
  40. data/lib/iolite/functinal/define_iolite_functinal_send_method.rb +0 -9
  41. data/lib/iolite/functinal/invoke.rb +0 -11
  42. data/lib/iolite/functinal/send.rb +0 -13
  43. data/lib/iolite/functinal.rb +0 -4
  44. data/lib/iolite/lazy.rb +0 -40
  45. data/lib/iolite/placeholders.rb +0 -30
  46. data/lib/iolite/refinements/array.rb +0 -16
  47. data/lib/iolite/refinements/hash.rb +0 -18
  48. data/lib/iolite/refinements/object_with_to_lazy.rb +0 -9
  49. data/lib/iolite/refinements/proc.rb +0 -9
  50. data/lib/iolite/refinements/string.rb +0 -26
  51. data/lib/iolite/refinements.rb +0 -6
  52. data/lib/iolite/statement/if.rb +0 -50
  53. data/lib/iolite/statement/if_else.rb +0 -12
  54. data/lib/iolite/statement.rb +0 -3
  55. data/lib/iolite/version.rb +0 -3
  56. data/lib/iolite.rb +0 -14
  57. data/spec/iolite_adaptored_spec.rb +0 -105
  58. data/spec/iolite_functinal_spec.rb +0 -87
  59. data/spec/iolite_lazy_spec.rb +0 -92
  60. data/spec/iolite_spec.rb +0 -212
  61. data/spec/spec_helper.rb +0 -2
@@ -1,9 +0,0 @@
1
- require "iolite/adaptor/to_lazy"
2
-
3
- module Iolite module Refinements
4
- module ObjectWithToLazy
5
- refine Object do
6
- include Iolite::Adaptor::ToLazy
7
- end
8
- end
9
- end end
@@ -1,9 +0,0 @@
1
- require "iolite/adaptor/all"
2
-
3
- module Iolite module Refinements
4
- module Proc
5
- refine ::Proc do
6
- include Iolite::Adaptor::All
7
- end
8
- end
9
- end end
@@ -1,26 +0,0 @@
1
- require "iolite/adaptor/all"
2
- require "iolite/functinal/invoke"
3
-
4
- module Iolite module Refinements
5
- module String
6
- refine ::String do
7
- include Iolite::Adaptor::ToProc
8
- include Iolite::Adaptor::Callable
9
- def call *args
10
- result = self.clone
11
- args.each_with_index { |it, i|
12
- result.gsub! Iolite::Placeholders.const_get("ARG#{i+1}").to_s, it.to_s
13
- }
14
- result
15
- end
16
-
17
- def to_call_by_eval binding = nil
18
- Iolite.lambda { |*args|
19
- gsub(/#{'#{(.*?)}'}/) {
20
- eval($1, binding).call(*args)
21
- }
22
- }
23
- end
24
- end
25
- end
26
- end end
@@ -1,6 +0,0 @@
1
- require "iolite/refinements/object_with_to_lazy"
2
- # require "iolite/refinements/array"
3
- # require "iolite/refinements/hash"
4
- # require "iolite/refinements/proc"
5
- # require "iolite/refinements/string"
6
-
@@ -1,50 +0,0 @@
1
- require "iolite/lazy"
2
- require "iolite/functinal"
3
-
4
- module Iolite module Statement
5
-
6
- class IfThenElse
7
- def initialize cond, then_
8
- @cond = cond
9
- @then_ = then_
10
- end
11
-
12
- def [](*else_)
13
- Iolite.lazy { |*args|
14
- if Iolite::Functinal.invoke(@cond, *args)
15
- Iolite::Functinal.invoke_a(@then_, *args).last
16
- else
17
- Iolite::Functinal.invoke_a(else_, *args).last
18
- end
19
- }
20
- end
21
- end
22
-
23
- class If
24
- def initialize cond
25
- @cond = cond
26
- end
27
-
28
- def [](*then_)
29
- if_then = Iolite::Lazy.new { |*args|
30
- if Iolite::Functinal.invoke(@cond, *args)
31
- Iolite::Functinal.invoke_a(then_, *args).last
32
- end
33
- }
34
- cond = @cond
35
- (class << if_then; self; end).class_eval {
36
- define_method(:else_) {
37
- IfThenElse.new cond, then_
38
- }
39
- }
40
- if_then
41
- end
42
- end
43
-
44
- def if_ cond
45
- If.new cond
46
- end
47
-
48
- module_function :if_
49
-
50
- end end
@@ -1,12 +0,0 @@
1
- module Iolite module Statement
2
- def if_else cond, then_, else_
3
- Lazy.new { |*args|
4
- if Functinal.invoke(cond, *args)
5
- Functinal.invoke(then_, *args)
6
- else
7
- Functinal.invoke(else_, *args)
8
- end
9
- }
10
- end
11
- module_function :if_else
12
- end end
@@ -1,3 +0,0 @@
1
- require "iolite/statement/if"
2
- require "iolite/statement/if_else"
3
-
@@ -1,3 +0,0 @@
1
- module Iolite
2
- VERSION = "0.0.3"
3
- end
data/lib/iolite.rb DELETED
@@ -1,14 +0,0 @@
1
- require "iolite/version"
2
- require "iolite/adaptor"
3
- require "iolite/functinal"
4
- require "iolite/lazy"
5
- require "iolite/placeholders"
6
- require "iolite/statement"
7
-
8
- # Not support 1.9.x
9
- require "iolite/refinements" if RUBY_VERSION.to_f > 2.0
10
-
11
- module Iolite
12
- include Functinal
13
- include Statement
14
- end
@@ -1,105 +0,0 @@
1
- load 'spec_helper.rb'
2
- require "iolite"
3
- require "iolite/adaptored/array"
4
- require "iolite/adaptored/hash"
5
- require "iolite/adaptored/proc"
6
- require "iolite/adaptored/string"
7
- require "iolite/adaptored/object_with_to_lazy"
8
-
9
- describe "Iolite Adaptored" do
10
- include Iolite::Placeholders
11
-
12
- describe "Array" do
13
- it "call" do
14
- expect([arg1, arg1, arg1].call(1)).to eq([1, 1, 1])
15
- end
16
- it "call with value" do
17
- expect([arg1, 3, arg1].call(1)).to eq([1, 3, 1])
18
- end
19
- it "bind" do
20
- expect([arg1, arg1, arg1].bind(arg2).call(1, 2)).to eq([2, 2, 2])
21
- end
22
- it "call invoke" do
23
- expect(Iolite::Functinal.invoke([arg1, arg1, arg1], 1)).to eq([1, 1, 1])
24
- end
25
- it "nest" do
26
- expect([arg1, [arg2, arg3]].call(1, 2, 3)).to eq([1, [2, 3]])
27
- end
28
- it "nest binding" do
29
- expect([arg1, [arg1, arg2].bind(arg3, arg2)].call(1, 2, 3)).to eq([1, [3, 2]])
30
- end
31
- end
32
-
33
- describe "Hash" do
34
- it "call" do
35
- expect({ arg1 => arg2 }.call(:name, :homu)).to eq({ name: :homu })
36
- end
37
- it "call key" do
38
- expect({ arg1 => :mami }.call(:name, :homu)).to eq({ name: :mami })
39
- end
40
- it "call value" do
41
- expect({ :mami => arg1 }.call(:name, :homu)).to eq({ mami: :name })
42
- end
43
- it "calls" do
44
- expect({ arg1 => arg2, arg1 => arg3 }.call(:name, :homu, :mado)).to eq({ name: :homu, name: :mado })
45
- end
46
- it "bind" do
47
- expect({ arg1 => arg3, arg2 => arg4 }.bind(arg1, arg1, arg2, arg3).call(:name, :homu, :mado)).to eq({ name: :homu, name: :mado })
48
- end
49
- end
50
-
51
- describe "Proc" do
52
- describe "operator" do
53
- it "proc" do
54
- expect((proc { 10 } + 20).call()).to eq(30)
55
- end
56
- it "lambda" do
57
- expect((lambda { 10 } + 20).call()).to eq(30)
58
- end
59
- end
60
- describe "bind" do
61
- it "proc" do
62
- expect(proc { |a, b| a + b }.bind(arg1, 2).call(1)).to eq(3)
63
- end
64
- it "lambda" do
65
- expect(proc { |a, b| a - b }.bind(2, arg1).call(1)).to eq(1)
66
- end
67
- end
68
- describe "Symbol" do
69
- it "#to_proc" do
70
- expect((arg1.to_s + :to_s.to_proc).call(42)).to eq("4242")
71
- end
72
- end
73
- end
74
-
75
- describe "String" do
76
- it "call" do
77
- expect("value:#{arg1}:#{arg2}".call(1, 2)).to eq("value:1:2")
78
- end
79
- it "#to_call_by_eval" do
80
- expect('value:#{ Iolite::Placeholders.arg1 }:#{ Iolite::Placeholders.arg2 }'.to_call_by_eval.call(1, 2)).to eq("value:1:2")
81
- end
82
- it "#to_call_by_eval binding" do
83
- var = 10
84
- expect('value:#{ arg1 + arg2 * var }:#{ arg2 - arg1 }'.to_call_by_eval(binding).call(1, 2)).to eq("value:21:1")
85
- end
86
- end
87
-
88
- describe "Object" do
89
- describe "#to_lazy" do
90
- it "lazy" do
91
- expect(1.to_lazy.call()).to eq(1)
92
- end
93
- it "operator" do
94
- expect((1.to_lazy + 2).call()).to eq(3)
95
- end
96
- it "operator with placeholder" do
97
- expect((1.to_lazy + arg1).call(2)).to eq(3)
98
- end
99
- it "call method" do
100
- expect(((1..10).to_lazy.first arg1).call(3)).to eq([1, 2, 3])
101
- end
102
- end
103
- end
104
- end
105
-
@@ -1,87 +0,0 @@
1
- load 'spec_helper.rb'
2
- require "iolite/functinal"
3
-
4
-
5
- describe "Iolite::Functinal" do
6
- include Iolite::Functinal
7
- class Callable
8
- def iolite_functinal_invoke_call a, b
9
- a + b
10
- end
11
- end
12
- class Uncallable
13
- def call x
14
- x + x
15
- end
16
- end
17
-
18
- class First
19
- def iolite_functinal_invoke_call *args
20
- args[0]
21
- end
22
- def call *args
23
- args[0]
24
- end
25
- end
26
- first = First.new
27
-
28
- describe ".invoke" do
29
- it "callable" do
30
- expect(invoke(Callable.new, 1, 2)).to eq(3)
31
- end
32
- it "uncallable" do
33
- expect(invoke(3, 1)).to eq(3)
34
- end
35
- it "uncallable call" do
36
- expect(invoke(Uncallable.new, 1).class).to eq(Uncallable)
37
- end
38
- #it "uncallable proc" do
39
- # expect(invoke(proc { |a, b| a + b }, 1, 2).class).to eq(Proc)
40
- #end
41
- end
42
-
43
- describe ".invoke_a" do
44
- it "callable" do
45
- expect(invoke_a([Callable.new, Callable.new], 1, 2)).to eq([3, 3])
46
- end
47
- it "uncallable" do
48
- expect(invoke_a([1, 2], 1)).to eq([1, 2])
49
- end
50
- end
51
-
52
- describe ".send" do
53
- it "send callable" do
54
- expect(send(4, :+, Callable.new).call(1, 2)).to eq(7)
55
- end
56
- it "send callable" do
57
- expect(send(Callable.new, :+, Callable.new).call(1, 2)).to eq(6)
58
- end
59
- it "send with block" do
60
- expect(send(first, :select){ |it| it > 1 }.call([1, 2, 3])).to eq([2, 3])
61
- end
62
- end
63
-
64
- describe ".bind" do
65
- # it "bind callable" do
66
- # expect(bind(-> a, b { a + b }, 1, First.new).call(1, 2)).to eq(2)
67
- # end
68
- # it "bind method" do
69
- # expect(bind(:+.to_proc, 1, First.new).call(2)).to eq(3)
70
- # end
71
- # it "bind next" do
72
- # expect(bind(-> a, b { a + b }, bind(-> a, b { a + b }, First.new, First.new), First.new).call(3)).to eq(9)
73
- # end
74
- it "apply first" do
75
- expect(bind(First.new, 1, 2).call(-> a, b { a + b })).to eq(3)
76
- end
77
- end
78
-
79
- # describe ".apply" do
80
- # it "call first" do
81
- # expect(apply(-> a { -> b { a + b} }, 1).call(2)).to eq(3)
82
- # end
83
- # it "NoMethodError" do
84
- # expect{ apply(-> a { 10 }, 1).call(2) }.to raise_error(NoMethodError)
85
- # end
86
- # end
87
- end
@@ -1,92 +0,0 @@
1
- load 'spec_helper.rb'
2
- require "iolite/lazy"
3
-
4
-
5
- describe "Iolite lazy" do
6
- describe "Iolite::lazy" do
7
- include Iolite
8
- arg1 = Iolite.lazy { |*args| args[0] }
9
- arg2 = Iolite.lazy { |*args| args[1] }
10
-
11
- describe "#class" do
12
- it "#class by Obejct#class" do
13
- expect(lazy { |a, b| a + b }.class).to eq(Iolite::Lazy)
14
- end
15
- end
16
-
17
- describe "#call" do
18
- it "call" do
19
- expect(lazy { |a, b| a + b }.call(1, 2)).to eq(3)
20
- end
21
- end
22
-
23
- describe "#bind" do
24
- it "bind argument" do
25
- expect(lazy { |a, b| a + b }.bind(1, 2).call()).to eq(3)
26
- end
27
- it "bind placeholders" do
28
- expect(lazy { |a, b| a + b }.bind(arg2, 2).call(2, 1)).to eq(3)
29
- end
30
- it "bind by placeholders" do
31
- expect((arg1 - arg2).bind(arg2, 2).call(1, 1)).to eq(-1)
32
- end
33
- end
34
-
35
- describe "#send" do
36
- it "send method" do
37
- expect(arg1.send(:length).call("homu")).to eq(4)
38
- end
39
- it "send Object method" do
40
- expect(arg1.send(:class).call("homu")).to eq(String)
41
- end
42
- end
43
-
44
- describe "#method_missing" do
45
- it "send method" do
46
- expect(arg1.length.call("homu")).to eq(4)
47
- end
48
- it "send Object method" do
49
- expect(arg1.class).to eq(arg1.__send__(:class))
50
- end
51
- end
52
-
53
- describe "#apply" do
54
- it "apply lazy" do
55
- expect(arg1.apply(1, 2).call(arg1 + arg2)).to eq(3)
56
- end
57
- end
58
-
59
- describe "#+" do
60
- it "call lazy" do
61
- expect((lazy { |a, b| a + b } + 3).call(1, 2)).to eq(6)
62
- end
63
- end
64
-
65
- describe "#==" do
66
- it "call" do
67
- expect((arg1 == 3).call(3)).to eq(true)
68
- end
69
- end
70
-
71
- describe "#===" do
72
- it "call" do
73
- expect((arg1 === arg2).call(/^m/, "mami")).to eq(true)
74
- end
75
- end
76
-
77
- describe "#to_s" do
78
- it "Symbol#to_s" do
79
- expect(arg1.to_s.call(:mami)).to eq("mami")
80
- end
81
- it "Fixnum#to_s" do
82
- expect(arg1.to_s.call(42)).to eq("42")
83
- end
84
- end
85
-
86
- describe "#class" do
87
- it "Symbol#class" do
88
- expect(arg1.class.call(:mami)).to eq(Symbol)
89
- end
90
- end
91
- end
92
- end
data/spec/iolite_spec.rb DELETED
@@ -1,212 +0,0 @@
1
- load 'spec_helper.rb'
2
-
3
- describe Iolite do
4
- it 'has a version number' do
5
- expect(Iolite::VERSION).not_to be nil
6
- end
7
-
8
- describe "Iolite" do
9
- it "::lazy" do
10
- expect(Iolite.lazy { |a, b| a + b }.class).to eq(Iolite::Lazy)
11
- end
12
- # it "::wrap" do
13
- # expect((Iolite.wrap lambda { |a, b| a + b }).call(1, 2).class).to eq(Proc)
14
- # end
15
- end
16
-
17
- describe "Iolite::Lazy" do
18
- first = Iolite::lazy { |x| x }
19
- plus = Iolite::lazy { |a, b| a + b }
20
- describe "#call" do
21
- it "call" do
22
- expect(first.call(10)).to eq(10)
23
- end
24
-
25
- it "()" do
26
- expect(first.(10)).to eq(10)
27
- end
28
-
29
- it "call multi arguments" do
30
- expect(first.call(10, 2)).to eq(10)
31
- expect(plus.call(10, 2)).to eq(12)
32
- end
33
- end
34
-
35
- describe "#bind" do
36
- include Iolite::Placeholders
37
- f = Iolite::lazy { |a, b| a + b }
38
- it "argument" do
39
- expect(f.bind(-3, 1).call()).to eq(-2)
40
- end
41
- it "argument" do
42
- expect(f.bind(arg2, arg1).call(-1, 3)).to eq(2)
43
- end
44
- it "operator" do
45
- expect(Iolite::lazy(&:+).bind(arg2, arg1).call(-1, 3)).to eq(2)
46
- end
47
- end
48
-
49
- describe "#send" do
50
- it "call method" do
51
- expect(first.send(:to_s).call(10).class).to eq(String)
52
- end
53
- it "call method with args" do
54
- expect(first.send(:+, 1).call(2)).to eq(3)
55
- end
56
- include Iolite::Placeholders
57
- it "call method with placeholders" do
58
- expect(first.send(:+, arg2).call(2, -2)).to eq(0)
59
- end
60
- end
61
-
62
- describe "#apply" do
63
- include Iolite::Placeholders
64
- it "call lambda" do
65
- expect(arg1.apply(1, 2).call(lambda { |a ,b| a + b })).to eq(3)
66
- end
67
- it "call Iolite::Lazy" do
68
- expect(arg1.apply(1, 2).call(Iolite::lazy { |a ,b| a + b })).to eq(3)
69
- end
70
- end
71
-
72
- describe "operators" do
73
- it "a + b" do
74
- expect((first + first).call(1)).to eq(2)
75
- end
76
- it "a - b" do
77
- expect((plus - first).call(2, 3)).to eq(3)
78
- end
79
- it "a * b" do
80
- expect((first * first).call(2)).to eq(4)
81
- end
82
- it "a[b]" do
83
- expect((first[:name]).call({name: :homu})).to eq(:homu)
84
- end
85
- it "a + {value}" do
86
- expect((first + 3).call(4)).to eq(7)
87
- end
88
- it "==" do
89
- expect([1, 2, 3].any? &first == 3).to eq(true)
90
- end
91
- it "=~" do
92
- expect(["homu", "123", "mami"].any? &first =~ /\d+/).to eq(true)
93
- end
94
- it "!" do
95
- expect([1, nil, 6].find_index &!first).to eq(1)
96
- end
97
- end
98
-
99
- describe "#method_missing" do
100
- it "call #length method" do
101
- expect(first.length.call("homu")).to eq(4)
102
- end
103
- it "call #to_s method" do
104
- expect(first.to_i.call("1").class).to eq(Fixnum)
105
- end
106
- it "call Object#*" do
107
- # not call method_missing
108
- expect(first.class).to eq(Iolite::Lazy)
109
- end
110
- it "call Object#* from #send" do
111
- expect(first.send(:class).call("homu")).to eq(String)
112
- end
113
- end
114
-
115
- describe "Array block" do
116
- it "#map by" do
117
- expect((1..3).map &(first + 3)).to eq([4, 5, 6])
118
- end
119
- it "#inject by" do
120
- expect((2..4).inject &(plus)).to eq(9)
121
- end
122
- end
123
- end
124
-
125
- describe "Iolite::Placeholders" do
126
- include Iolite::Placeholders
127
- it "arg1" do
128
- expect(arg1.call(1, 2)).to eq(1)
129
- end
130
- it "arg1 + arg2" do
131
- expect((arg1 + arg2).call(1, 2)).to eq(3)
132
- end
133
- it "arg1[arg2]" do
134
- expect((arg1[arg2]).call([1, 2, 3], 2)).to eq(3)
135
- end
136
- it "args" do
137
- expect((args[arg2]).call(1, 3, 2, 4)).to eq(4)
138
- end
139
- it "bind" do
140
- # expect(arg1.bind(10).call(Iolite.lambda { |x| x + x})).to eq(20)
141
- end
142
- it "alias _1, arg1" do
143
- expect((_1 + _2).call(1, 2)).to eq(3)
144
- end
145
- end
146
-
147
- describe "Iolite::adaptor" do
148
- describe "Adapt callable" do
149
- include Iolite::Placeholders
150
- class UnCallableFromIolite
151
- end
152
- it "not callable" do
153
- # UnCallableFromIolite.new.class
154
- expect(arg1.send(:class).bind(UnCallableFromIolite.new).call(10)).to eq(UnCallableFromIolite)
155
- end
156
- class CallableFromIolite
157
- include Iolite::Adaptor::Callable
158
- def call n
159
- n
160
- end
161
- end
162
- it "callable" do
163
- # CallableFromIolite.new.call("homu")
164
- expect(arg1.send(:class).bind(CallableFromIolite.new).call("homu")).to eq(String)
165
- end
166
- it "wrap" do
167
- # expect(arg1.send(:class).bind(Iolite.wrap CallableFromIolite.new).call("homu")).to eq(CallableFromIolite)
168
- end
169
- end
170
- end
171
-
172
- describe "Iolite::Statement" do
173
- describe "if_else" do
174
- include Iolite::Statement
175
- include Iolite::Placeholders
176
- it "call then" do
177
- f = if_else(arg1 > 0, arg2, nil)
178
- expect(f.(10, "yes")).to eq("yes")
179
- end
180
- it "call else" do
181
- f = if_else(arg1 > 0, arg2, nil)
182
- expect(f.(-10, "yes")).to eq(nil)
183
- end
184
- end
185
- describe "if_" do
186
- describe "if then" do
187
- include Iolite::Statement
188
- include Iolite::Placeholders
189
- it "call then" do
190
- f = if_(arg1 > 0)[ arg1, arg1 + arg1 ]
191
- expect(f.(10)).to eq(20)
192
- end
193
- it "call else" do
194
- f = if_(arg1 > 0)[ arg1, arg1 + arg1 ]
195
- expect(f.(0)).to eq(nil)
196
- end
197
- end
198
- describe "if then else" do
199
- include Iolite::Statement
200
- include Iolite::Placeholders
201
- it "call then" do
202
- f = if_(arg1 > 0)[ arg1, arg1 + arg1 ].else_[ arg1, arg1 - arg1 ]
203
- expect(f.(10)).to eq(20)
204
- end
205
- it "call else" do
206
- f = if_(arg1 > 0)[ arg1, arg1 + arg1 ].else_[ arg1, arg1 - arg1 ]
207
- expect(f.(-10)).to eq(0)
208
- end
209
- end
210
- end
211
- end
212
- end
data/spec/spec_helper.rb DELETED
@@ -1,2 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'iolite'