@@ -29,17 +29,11 @@ def initialize(arity, curried)
2929 end
3030 end
3131
32- def constant?
33- arity . zero?
34- end
32+ def constant? = arity . zero?
3533
36- def variable_arity?
37- arity . negative?
38- end
34+ def variable_arity? = arity . negative?
3935
40- def curried?
41- !curried . zero?
42- end
36+ def curried? = !curried . zero?
4337
4438 def unapplied
4539 if variable_arity?
@@ -116,26 +110,26 @@ def define_application
116110 application = "@predicate[#{ ( curried_args + unapplied_args + splat ) . join ( ", " ) } ]"
117111
118112 module_eval ( <<~RUBY , __FILE__ , __LINE__ + 1 )
119- def call(#{ parameters } ) # def call(input0, input1, *rest)
120- if #{ application } # if @predicate[@arg0, @arg1, input0, input1, *rest]
121- Result::SUCCESS # ::Dry::Logic::Result::Success
122- else # else
123- Result.new(false, id) { ast(#{ parameters } ) } # ::Dry::Logic::Result.new(false, id) { ast(input0, input1, *rest) }
124- end # end
125- end # end
126- #
127- def [](#{ parameters } ) # def [](@arg0, @arg1, input0, input1, *rest)
128- #{ application } # @predicate[@arg0, @arg1, input0, input1, *rest]
129- end # end
113+ def call(#{ parameters } ) # def call(input0, input1, *rest)
114+ if #{ application } # if @predicate[@arg0, @arg1, input0, input1, *rest]
115+ Result::SUCCESS # ::Dry::Logic::Result::Success
116+ else # else
117+ Result.new(false, id) { ast(#{ parameters } ) } # ::Dry::Logic::Result.new(false, id) { ast(input0, input1, *rest) }
118+ end # end
119+ end # end
120+ #
121+ def [](#{ parameters } ) # def [](@arg0, @arg1, input0, input1, *rest)
122+ #{ application } # @predicate[@arg0, @arg1, input0, input1, *rest]
123+ end # end
130124 RUBY
131125 end
132126
133127 def curried_args
134- @curried_args ||= ::Array . new ( curried ) { | i | "@arg#{ i } " }
128+ @curried_args ||= ::Array . new ( curried ) { "@arg#{ _1 } " }
135129 end
136130
137131 def unapplied_args
138- @unapplied_args ||= ::Array . new ( unapplied ) { | i | "input#{ i } " }
132+ @unapplied_args ||= ::Array . new ( unapplied ) { "input#{ _1 } " }
139133 end
140134 end
141135 end
0 commit comments