mobj 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/ext/array.rb +14 -0
- data/lib/ext/false.rb +26 -0
- data/lib/ext/hash.rb +4 -0
- data/lib/ext/nil.rb +3 -0
- data/lib/ext/object.rb +7 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTBkYzM1ZjkzNzcwYTJkM2E5YTJhMjcxNGYzMjllODdmZGUwMTUwOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjdjZmI4MTIwOTRkNDc3YmY3ODY3MmRjYWIzNzE5ODcwNDE0MDVjZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDdkMzFmZjNmZWQ1YzBiODM3YjUxYTM0MjVmYjAwNzNjNDY2N2RhMTE4NmM5
|
10
|
+
MjJhNGJlM2EzNWI5MmQ0NWZiNjY4NmVhYjhlOGYwYzBkMmE4YzgzZTVlNjc1
|
11
|
+
NWUxYTk2ZGU1YTVhZWY2NTBlZGZmNmNhNTU5MDhkMmRiMGQ1M2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmU5NzgzODkxOGVkYmI5NDllMzJlMjdhZTUxZjBmNDhhMzNjYzg2M2E4OTNk
|
14
|
+
Nzc1OTkxNmQ2N2M2N2RjYTI4MmRiODUwNmYzNTBhNjk0YzhlZDI4ODFkYzU5
|
15
|
+
MDRkMjEwZjVlMzI2Y2Q2Mjg4YjY4ZGQwNjU2ZGEyODZiOTIyNTE=
|
data/lib/ext/array.rb
CHANGED
@@ -72,6 +72,20 @@ module Mobj
|
|
72
72
|
map { |item| item.send(method, *args) }
|
73
73
|
end
|
74
74
|
end
|
75
|
+
|
76
|
+
def mall?(op, &block)
|
77
|
+
if op
|
78
|
+
all? { |item| item.send(op) }
|
79
|
+
elsif block
|
80
|
+
all? { |item| item.instance_exec(item, &block) }
|
81
|
+
else
|
82
|
+
all? { |item| item }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def hmap(&block)
|
87
|
+
each.with_object({}, &block)
|
88
|
+
end
|
75
89
|
end
|
76
90
|
|
77
91
|
end
|
data/lib/ext/false.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Mobj
|
2
|
+
|
3
|
+
class ::FalseClass
|
4
|
+
|
5
|
+
def zero?
|
6
|
+
true
|
7
|
+
end
|
8
|
+
|
9
|
+
def tru?(_=nil, f=nil, &block)
|
10
|
+
f
|
11
|
+
end
|
12
|
+
|
13
|
+
def fals?(val=nil, &block)
|
14
|
+
if block
|
15
|
+
block.call(val)
|
16
|
+
else
|
17
|
+
val
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def iff?(_=nil)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/lib/ext/hash.rb
CHANGED
data/lib/ext/nil.rb
CHANGED
data/lib/ext/object.rb
CHANGED
@@ -3,8 +3,8 @@ module Mobj
|
|
3
3
|
class ::Object
|
4
4
|
alias_method :responds_to?, :respond_to?
|
5
5
|
|
6
|
-
def i!() to_s.to_i end
|
7
|
-
def f!() to_s.to_f end
|
6
|
+
def i!() to_s.scan(/[\d\.]+/).join.to_i end #xxx strip out junk?
|
7
|
+
def f!() to_s.scan(/[\d\.]+/).join.to_f end
|
8
8
|
def z0?() respond_to?(:zero?) ? zero? : f!.zero? end
|
9
9
|
def zeno!() z0? ? 1.0 : self end
|
10
10
|
|
@@ -98,6 +98,11 @@ module Mobj
|
|
98
98
|
end
|
99
99
|
|
100
100
|
alias_method :if?, :when
|
101
|
+
|
102
|
+
def iff?(value = nil, &block)
|
103
|
+
block ? instance_exec(value, &block) : value
|
104
|
+
end
|
105
|
+
|
101
106
|
end
|
102
107
|
|
103
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mason Glaves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/ext/array.rb
|
50
50
|
- lib/ext/basic_object.rb
|
51
51
|
- lib/ext/class.rb
|
52
|
+
- lib/ext/false.rb
|
52
53
|
- lib/ext/fixnum.rb
|
53
54
|
- lib/ext/float.rb
|
54
55
|
- lib/ext/hash.rb
|