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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjgyNWY0ZmU0NTFiNjg5MTVhZjVkYmFiODExZGEyYTNlODBjMjcxYQ==
4
+ NTBkYzM1ZjkzNzcwYTJkM2E5YTJhMjcxNGYzMjllODdmZGUwMTUwOA==
5
5
  data.tar.gz: !binary |-
6
- ZTEwN2FmZGM4YWVkYTU3NmM3NmI0MWM0ZWY1MDlmMjViOTU1M2I0Yg==
6
+ YjdjZmI4MTIwOTRkNDc3YmY3ODY3MmRjYWIzNzE5ODcwNDE0MDVjZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YWY0Y2I2MDNiNzIwMmE0OTIyMDhlMDdhZGQ0MTIyYjcyYTlhMTIxZmI5MWFh
10
- ZmUzYTk2M2M2MjA4NDJmOWViYWIwZjUyYzZmYTlkZDMyMzI2MGZmN2Q3OWU0
11
- ZWRmNjNkZDgzY2UxZDExZjcwNjg1ZDA1NzExN2I2MGI4YjlhODk=
9
+ NDdkMzFmZjNmZWQ1YzBiODM3YjUxYTM0MjVmYjAwNzNjNDY2N2RhMTE4NmM5
10
+ MjJhNGJlM2EzNWI5MmQ0NWZiNjY4NmVhYjhlOGYwYzBkMmE4YzgzZTVlNjc1
11
+ NWUxYTk2ZGU1YTVhZWY2NTBlZGZmNmNhNTU5MDhkMmRiMGQ1M2Q=
12
12
  data.tar.gz: !binary |-
13
- N2EwYjBkNTIzNzAxOWVjMDAxNTQwZDAyZmFkZjhiZWQwZmViZDAzOGMwODQ4
14
- ZDZkNWY4MmMyMzdjY2NjMTlkYTIzZDI3OWE1OTFlMzU4MDFiMTIwMTVkNzI5
15
- MjBjZmIyYTNhMmFmMjRiNDQ0ODM2MDkwZGE3MjAwNzJmNDgyZTI=
13
+ NmU5NzgzODkxOGVkYmI5NDllMzJlMjdhZTUxZjBmNDhhMzNjYzg2M2E4OTNk
14
+ Nzc1OTkxNmQ2N2M2N2RjYTI4MmRiODUwNmYzNTBhNjk0YzhlZDI4ODFkYzU5
15
+ MDRkMjEwZjVlMzI2Y2Q2Mjg4YjY4ZGQwNjU2ZGEyODZiOTIyNTE=
@@ -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
@@ -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
@@ -66,6 +66,10 @@ module Mobj
66
66
 
67
67
  return block ? block[value] : value
68
68
  end
69
+
70
+ def denil!
71
+ reject!{ |k, v| k.nil? || v.nil? }
72
+ end
69
73
  end
70
74
 
71
75
  class ::Hash
@@ -26,6 +26,9 @@ module Mobj
26
26
  end
27
27
  end
28
28
 
29
+ def iff?(_=nil)
30
+ end
31
+
29
32
  def null?(*)
30
33
  @@null ||= nil
31
34
  @@null && @@null == __mobj__caller
@@ -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.0.0
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-06-08 00:00:00.000000000 Z
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