fuby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +8 -0
- data/VERSION +1 -0
- data/fuby.gemspec +21 -0
- data/lib/fuby.rb +1 -0
- data/lib/fuby/abbreviation.rb +20 -0
- data/lib/fuby/alias_method.rb +13 -0
- data/lib/fuby/all.rb +11 -0
- data/lib/fuby/and.rb +9 -0
- data/lib/fuby/any.rb +11 -0
- data/lib/fuby/attributes.rb +17 -0
- data/lib/fuby/bind.rb +21 -0
- data/lib/fuby/class_attributes.rb +39 -0
- data/lib/fuby/deep.rb +1 -0
- data/lib/fuby/deep_each.rb +14 -0
- data/lib/fuby/define_instance_method.rb +18 -0
- data/lib/fuby/define_missing_method.rb +36 -0
- data/lib/fuby/define_object_method.rb +18 -0
- data/lib/fuby/define_tok.rb +11 -0
- data/lib/fuby/descendants.rb +15 -0
- data/lib/fuby/dimension.rb +23 -0
- data/lib/fuby/drop.rb +20 -0
- data/lib/fuby/drop_until.rb +18 -0
- data/lib/fuby/drop_while.rb +15 -0
- data/lib/fuby/each.rb +2 -0
- data/lib/fuby/each_with_index_or_key.rb +19 -0
- data/lib/fuby/eql.rb +1 -0
- data/lib/fuby/eql_componentwise.rb +13 -0
- data/lib/fuby/equivalence.rb +13 -0
- data/lib/fuby/eval.rb +54 -0
- data/lib/fuby/extend.rb +13 -0
- data/lib/fuby/format.rb +9 -0
- data/lib/fuby/include.rb +13 -0
- data/lib/fuby/index_or_key.rb +19 -0
- data/lib/fuby/instance_attributes.rb +39 -0
- data/lib/fuby/intercept.rb +27 -0
- data/lib/fuby/invert.rb +16 -0
- data/lib/fuby/longest_common.rb +16 -0
- data/lib/fuby/matches.rb +11 -0
- data/lib/fuby/matches_componentwise.rb +11 -0
- data/lib/fuby/matches_part_of.rb +16 -0
- data/lib/fuby/matches_prefix_of.rb +11 -0
- data/lib/fuby/matches_suffix_of.rb +13 -0
- data/lib/fuby/member.rb +11 -0
- data/lib/fuby/merge.rb +20 -0
- data/lib/fuby/merge_css.rb +32 -0
- data/lib/fuby/method_added_as.rb +1 -0
- data/lib/fuby/method_added_as_binary_operator.rb +16 -0
- data/lib/fuby/method_added_as_filter.rb +19 -0
- data/lib/fuby/new.rb +16 -0
- data/lib/fuby/not.rb +25 -0
- data/lib/fuby/opposite.rb +29 -0
- data/lib/fuby/or.rb +9 -0
- data/lib/fuby/otherwise.rb +18 -0
- data/lib/fuby/part_of.rb +16 -0
- data/lib/fuby/plus.rb +10 -0
- data/lib/fuby/pop.rb +11 -0
- data/lib/fuby/pop_if.rb +15 -0
- data/lib/fuby/pop_options.rb +15 -0
- data/lib/fuby/pop_unless.rb +11 -0
- data/lib/fuby/pop_until.rb +11 -0
- data/lib/fuby/pop_while.rb +11 -0
- data/lib/fuby/prefix_of.rb +14 -0
- data/lib/fuby/prefixes.rb +11 -0
- data/lib/fuby/prepend.rb +11 -0
- data/lib/fuby/private.rb +11 -0
- data/lib/fuby/protected.rb +11 -0
- data/lib/fuby/public.rb +11 -0
- data/lib/fuby/push.rb +1 -0
- data/lib/fuby/push_options.rb +9 -0
- data/lib/fuby/random.rb +31 -0
- data/lib/fuby/self_and_descendants.rb +15 -0
- data/lib/fuby/shift.rb +11 -0
- data/lib/fuby/shift_if.rb +12 -0
- data/lib/fuby/shift_options.rb +11 -0
- data/lib/fuby/shift_unless.rb +12 -0
- data/lib/fuby/shift_until.rb +12 -0
- data/lib/fuby/shift_while.rb +16 -0
- data/lib/fuby/splat.rb +11 -0
- data/lib/fuby/strip.rb +24 -0
- data/lib/fuby/subclass.rb +22 -0
- data/lib/fuby/submodule.rb +22 -0
- data/lib/fuby/suffix_of.rb +19 -0
- data/lib/fuby/suffixes.rb +11 -0
- data/lib/fuby/take.rb +20 -0
- data/lib/fuby/take_until.rb +17 -0
- data/lib/fuby/take_while.rb +14 -0
- data/lib/fuby/tap.rb +28 -0
- data/lib/fuby/to.rb +1 -0
- data/lib/fuby/to_boolean.rb +32 -0
- data/lib/fuby/to_camel_case.rb +32 -0
- data/lib/fuby/to_case.rb +1 -0
- data/lib/fuby/to_components.rb +33 -0
- data/lib/fuby/to_dash_case.rb +28 -0
- data/lib/fuby/to_hash.rb +25 -0
- data/lib/fuby/to_pred.rb +7 -0
- data/lib/fuby/to_proc.rb +45 -0
- data/lib/fuby/to_regexp.rb +38 -0
- data/lib/fuby/to_snake_case.rb +28 -0
- data/lib/fuby/to_tok.rb +27 -0
- data/lib/fuby/tok.rb +2 -0
- data/lib/fuby/tok_arity.rb +18 -0
- data/lib/fuby/tok_direction.rb +16 -0
- data/lib/fuby/tok_parity.rb +11 -0
- data/lib/fuby/tok_side.rb +11 -0
- data/lib/fuby/try.rb +73 -0
- data/lib/fuby/try_each.rb +25 -0
- data/lib/fuby/try_eval.rb +19 -0
- data/lib/fuby/try_exec.rb +15 -0
- data/lib/fuby/unabbreviation.rb +17 -0
- data/lib/fuby/unshift.rb +1 -0
- data/lib/fuby/unshift_options.rb +11 -0
- data/lib/fuby/uuid.rb +28 -0
- data/test/fuby/abbreviation.rb +25 -0
- data/test/fuby/alias_method.rb +29 -0
- data/test/fuby/all.rb +15 -0
- data/test/fuby/and.rb +14 -0
- data/test/fuby/any.rb +15 -0
- data/test/fuby/attributes.rb +0 -0
- data/test/fuby/bind.rb +17 -0
- data/test/fuby/class_attributes.rb +0 -0
- data/test/fuby/deep.rb +0 -0
- data/test/fuby/deep_each.rb +0 -0
- data/test/fuby/define_missing_method.rb +33 -0
- data/test/fuby/define_tok.rb +0 -0
- data/test/fuby/descendants.rb +0 -0
- data/test/fuby/dimension.rb +0 -0
- data/test/fuby/drop.rb +28 -0
- data/test/fuby/drop_until.rb +26 -0
- data/test/fuby/drop_while.rb +26 -0
- data/test/fuby/each.rb +0 -0
- data/test/fuby/each_with_index_or_key.rb +22 -0
- data/test/fuby/eql.rb +0 -0
- data/test/fuby/eql_componentwise.rb +0 -0
- data/test/fuby/equivalence.rb +0 -0
- data/test/fuby/eval.rb +0 -0
- data/test/fuby/extend.rb +20 -0
- data/test/fuby/format.rb +0 -0
- data/test/fuby/include.rb +20 -0
- data/test/fuby/index_or_key.rb +0 -0
- data/test/fuby/instance_attributes.rb +0 -0
- data/test/fuby/intercept.rb +16 -0
- data/test/fuby/invert.rb +0 -0
- data/test/fuby/longest_common.rb +0 -0
- data/test/fuby/matches.rb +0 -0
- data/test/fuby/matches_componentwise.rb +0 -0
- data/test/fuby/matches_prefix_of.rb +0 -0
- data/test/fuby/matches_suffix_of.rb +0 -0
- data/test/fuby/member.rb +0 -0
- data/test/fuby/merge.rb +0 -0
- data/test/fuby/merge_css.rb +0 -0
- data/test/fuby/method_added_as.rb +0 -0
- data/test/fuby/method_added_as_binary_operator.rb +20 -0
- data/test/fuby/method_added_as_filter.rb +28 -0
- data/test/fuby/new.rb +3 -0
- data/test/fuby/not.rb +0 -0
- data/test/fuby/opposite.rb +0 -0
- data/test/fuby/or.rb +19 -0
- data/test/fuby/otherwise.rb +30 -0
- data/test/fuby/part_of.rb +0 -0
- data/test/fuby/plus.rb +0 -0
- data/test/fuby/pop.rb +0 -0
- data/test/fuby/pop_if.rb +31 -0
- data/test/fuby/pop_options.rb +31 -0
- data/test/fuby/pop_unless.rb +0 -0
- data/test/fuby/pop_until.rb +0 -0
- data/test/fuby/pop_while.rb +0 -0
- data/test/fuby/prefix_of.rb +0 -0
- data/test/fuby/prefixes.rb +13 -0
- data/test/fuby/prepend.rb +34 -0
- data/test/fuby/private.rb +0 -0
- data/test/fuby/protected.rb +0 -0
- data/test/fuby/public.rb +0 -0
- data/test/fuby/push.rb +0 -0
- data/test/fuby/push_options.rb +32 -0
- data/test/fuby/random.rb +0 -0
- data/test/fuby/self_and_descendants.rb +0 -0
- data/test/fuby/shift.rb +0 -0
- data/test/fuby/shift_if.rb +0 -0
- data/test/fuby/shift_options.rb +0 -0
- data/test/fuby/shift_unless.rb +0 -0
- data/test/fuby/shift_until.rb +0 -0
- data/test/fuby/shift_while.rb +0 -0
- data/test/fuby/splat.rb +0 -0
- data/test/fuby/strip.rb +0 -0
- data/test/fuby/submodule.rb +15 -0
- data/test/fuby/suffix_of.rb +0 -0
- data/test/fuby/suffixes.rb +13 -0
- data/test/fuby/take.rb +0 -0
- data/test/fuby/take_until.rb +0 -0
- data/test/fuby/take_while.rb +0 -0
- data/test/fuby/tap.rb +58 -0
- data/test/fuby/to_boolean.rb +31 -0
- data/test/fuby/to_camel_case.rb +15 -0
- data/test/fuby/to_components.rb +0 -0
- data/test/fuby/to_dash_case.rb +15 -0
- data/test/fuby/to_hash.rb +23 -0
- data/test/fuby/to_pred.rb +25 -0
- data/test/fuby/to_proc.rb +56 -0
- data/test/fuby/to_regexp.rb +38 -0
- data/test/fuby/to_snake_case.rb +15 -0
- data/test/fuby/to_tok.rb +0 -0
- data/test/fuby/tok.rb +0 -0
- data/test/fuby/tok_arity.rb +0 -0
- data/test/fuby/tok_direction.rb +0 -0
- data/test/fuby/tok_parity.rb +0 -0
- data/test/fuby/tok_side.rb +0 -0
- data/test/fuby/try.rb +52 -0
- data/test/fuby/try_each.rb +30 -0
- data/test/fuby/try_eval.rb +34 -0
- data/test/fuby/try_exec.rb +0 -0
- data/test/fuby/unabbreviation.rb +25 -0
- data/test/fuby/unshift.rb +0 -0
- data/test/fuby/unshift_options.rb +0 -0
- data/test/fuby/uuid.rb +31 -0
- data/test/fuby/version.rb +0 -0
- metadata +369 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative 'not'
|
2
|
+
require_relative 'shift_until'
|
3
|
+
require_relative 'method_added_as_filter'
|
4
|
+
|
5
|
+
using Fuby
|
6
|
+
|
7
|
+
module Fuby
|
8
|
+
refine ::Array do
|
9
|
+
|
10
|
+
def shift_while &blk
|
11
|
+
shift_until &(blk.not)
|
12
|
+
end
|
13
|
+
|
14
|
+
method_added_as_filter :shift_while
|
15
|
+
end
|
16
|
+
end
|
data/lib/fuby/splat.rb
ADDED
data/lib/fuby/strip.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'plus'
|
2
|
+
|
3
|
+
using Fuby
|
4
|
+
|
5
|
+
module Fuby
|
6
|
+
refine ::String do
|
7
|
+
|
8
|
+
def strip pattern = nil
|
9
|
+
return super unless ::RegExp === pattern
|
10
|
+
strip_beginning(pattern).strip_ending(pattern)
|
11
|
+
end
|
12
|
+
|
13
|
+
def strip_beginning pattern
|
14
|
+
pattern = /^/ + pattern unless /^\^/ === pattern.source
|
15
|
+
sub pattern, ''
|
16
|
+
end
|
17
|
+
|
18
|
+
def strip_ending pattern
|
19
|
+
pattern = pattern + /$/ unless /\$$/ === pattern.source
|
20
|
+
sub pattern, ''
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'fuby/include'
|
2
|
+
|
3
|
+
using Fuby
|
4
|
+
|
5
|
+
module Fuby
|
6
|
+
refine ::Module do
|
7
|
+
|
8
|
+
def subclass *sig, &blk
|
9
|
+
case self
|
10
|
+
|
11
|
+
when Class
|
12
|
+
Class.new self
|
13
|
+
|
14
|
+
when Module
|
15
|
+
Class.new.include! self
|
16
|
+
|
17
|
+
else super
|
18
|
+
end.include! *sig, &blk
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'fuby/include'
|
2
|
+
|
3
|
+
using Fuby
|
4
|
+
|
5
|
+
module Fuby
|
6
|
+
refine ::Module do
|
7
|
+
|
8
|
+
def submodule *sig, &blk
|
9
|
+
case self
|
10
|
+
|
11
|
+
when Class
|
12
|
+
Class.new self
|
13
|
+
|
14
|
+
when Module
|
15
|
+
Module.new.include! self
|
16
|
+
|
17
|
+
else super
|
18
|
+
end.include! *sig, &blk
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
using Fuby
|
2
|
+
|
3
|
+
module Fuby
|
4
|
+
refine ::Array do
|
5
|
+
|
6
|
+
def suffix_of? that
|
7
|
+
eql? that.drop -length
|
8
|
+
end
|
9
|
+
|
10
|
+
def matches_suffix_of? that
|
11
|
+
matches? that.drop - length
|
12
|
+
end
|
13
|
+
|
14
|
+
method_added_as_binary_operator :suffix_of?, :matches_suffix_of?
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Dir.glob "*_suffix_of.rb", &method(:require)
|
data/lib/fuby/take.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
using Fuby
|
2
|
+
|
3
|
+
module Fuby
|
4
|
+
refine ::Array do
|
5
|
+
|
6
|
+
def take i = 1
|
7
|
+
return [] if empty?
|
8
|
+
return super if i >= 0
|
9
|
+
return super i % length
|
10
|
+
end
|
11
|
+
|
12
|
+
def take! i = 1
|
13
|
+
pop length - i % length
|
14
|
+
self
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Dir.glob "#{ __FILE__.chomp ".rb" }_*.rb", &method(:require)
|
data/lib/fuby/tap.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
using Fuby
|
2
|
+
|
3
|
+
module Fuby
|
4
|
+
refine ::Object do
|
5
|
+
|
6
|
+
def tap &blk
|
7
|
+
return super if block_given?
|
8
|
+
return self
|
9
|
+
end
|
10
|
+
|
11
|
+
alias_method :tap?, :tap
|
12
|
+
alias_method :tap!, :tap
|
13
|
+
|
14
|
+
end
|
15
|
+
refine ::NilClass do
|
16
|
+
|
17
|
+
def tap?
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def tap!
|
22
|
+
raise ::TypeError
|
23
|
+
end
|
24
|
+
|
25
|
+
alias_method :tap_each, :tap?
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/lib/fuby/to.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Dir.glob "#{ __FILE__.chomp ".rb" }_*.rb", &method(:require)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
using Fuby
|
2
|
+
|
3
|
+
module Fuby
|
4
|
+
refine ::Numeric do
|
5
|
+
|
6
|
+
def to_boolean
|
7
|
+
self > 0
|
8
|
+
end
|
9
|
+
|
10
|
+
alias_method :to_b, :to_boolean
|
11
|
+
|
12
|
+
end
|
13
|
+
refine ::String do
|
14
|
+
|
15
|
+
def to_boolean
|
16
|
+
/^(t(rue)?|0*1|y(es)?)$/i === self
|
17
|
+
end
|
18
|
+
|
19
|
+
alias_method :to_b, :to_boolean
|
20
|
+
|
21
|
+
end
|
22
|
+
refine ::Symbol do
|
23
|
+
|
24
|
+
def to_boolean
|
25
|
+
@to_boolean = to_s.to_boolean if @to_boolean.nil?
|
26
|
+
@to_boolean
|
27
|
+
end
|
28
|
+
|
29
|
+
alias_method :to_b, :to_boolean
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'to_components'
|
2
|
+
|
3
|
+
using Fuby
|
4
|
+
|
5
|
+
module Fuby
|
6
|
+
refine ::String do
|
7
|
+
|
8
|
+
def to_camelCase
|
9
|
+
components = to_components
|
10
|
+
first = components.shift.downcase
|
11
|
+
components.map! { |str| str.sub /[A-z0-9]/, &:upcase }
|
12
|
+
components.unshift first
|
13
|
+
components.join
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_CamelCase
|
17
|
+
to_components.map! { |str| str.sub /[A-z0-9]/, &:upcase }.join
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
refine ::Symbol do
|
22
|
+
|
23
|
+
def to_camelCase
|
24
|
+
@to_camelCase ||= to_s.to_camelCase.to_sym
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_CamelCase
|
28
|
+
@to_CamelCase ||= to_s.to_CamelCase.to_sym
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
data/lib/fuby/to_case.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Dir.glob "to_*_case.rb", &method(:require)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
using Fuby
|
2
|
+
|
3
|
+
module Fuby
|
4
|
+
refine ::String do
|
5
|
+
|
6
|
+
def to_components
|
7
|
+
return downcase.to_components if /[A-Z]/ === self unless /[a-z]/ === self # it's all CAPS
|
8
|
+
scan /[A-Z]+[0-9]*(?=_|\b|[^A-z]|[A-Z][a-z])|[A-Z]?[a-z]+[0-9]*(?=_|\b|[^a-z]|[A-Z])|[0-9]+[a-z]*/
|
9
|
+
#
|
10
|
+
# presuming either some form of camelCase or lower_case, either:
|
11
|
+
#
|
12
|
+
# a run of capitals optionally followed by an integer, excluding the capital leading a following CamelCase word
|
13
|
+
# e.g. HTML5, IE9
|
14
|
+
#
|
15
|
+
# a run of lower-case letters optionally followed by an integer
|
16
|
+
# e.g. html5, ie9
|
17
|
+
#
|
18
|
+
# a number or number word
|
19
|
+
# e.g. 1st, 2nd
|
20
|
+
#
|
21
|
+
# a proper camelCase component
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
refine ::Symbol do
|
26
|
+
|
27
|
+
def to_components
|
28
|
+
@to_components ||= to_s.to_components.map(&:to_sym).freeze
|
29
|
+
@to_components.dup
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'to_components'
|
2
|
+
|
3
|
+
using Fuby
|
4
|
+
|
5
|
+
module Fuby
|
6
|
+
refine ::String do
|
7
|
+
|
8
|
+
def to_DASH_CASE
|
9
|
+
to_components.join('-').upcase
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_dash_case
|
13
|
+
to_components.join('-').downcase
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
refine ::Symbol do
|
18
|
+
|
19
|
+
def to_DASH_CASE
|
20
|
+
@to_DASH_CASE ||= to_s.to_DASH_CASE.to_sym
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_dash_case
|
24
|
+
@to_dash_case ||= to_s.to_dash_case.to_sym
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/lib/fuby/to_hash.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'descendants'
|
2
|
+
require_relative 'each_with_index_or_key'
|
3
|
+
|
4
|
+
using Fuby
|
5
|
+
|
6
|
+
module Fuby
|
7
|
+
module ::Enumerable # can't refine a Module
|
8
|
+
|
9
|
+
def to_hash
|
10
|
+
{}.tap { |hash| each_with_index_or_key { |val, key| hash[key] = val } }
|
11
|
+
end
|
12
|
+
|
13
|
+
alias_method :to_h, :to_hash
|
14
|
+
|
15
|
+
end
|
16
|
+
refine ::Hash do
|
17
|
+
|
18
|
+
def to_hash
|
19
|
+
dup
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method :to_h, :to_hash
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/fuby/to_pred.rb
ADDED
data/lib/fuby/to_proc.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
module Fuby
|
2
|
+
refine ::Array do
|
3
|
+
|
4
|
+
def to_proc
|
5
|
+
proc &method(:[])
|
6
|
+
end
|
7
|
+
|
8
|
+
end
|
9
|
+
refine ::Hash do
|
10
|
+
|
11
|
+
def to_proc
|
12
|
+
proc do |arg|
|
13
|
+
if has_key? arg
|
14
|
+
self[arg]
|
15
|
+
else
|
16
|
+
self[keys.detect { |key| key === arg }]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
refine ::String do
|
23
|
+
|
24
|
+
def to_proc
|
25
|
+
proc { |*sig| format self, *sig }
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
refine ::Regexp do
|
30
|
+
|
31
|
+
def to_proc
|
32
|
+
proc do |arg|
|
33
|
+
arg[ arg.length - 1] if arg = match(arg)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
refine ::Integer do
|
39
|
+
|
40
|
+
def to_proc
|
41
|
+
proc { |arg| arg[self] }
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|