mobj 2.9.6 → 3.0.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
- ZjQzYjlkODFmNDFkZmVlODEzMDlkOTFkMzY0NDI1ZTA5Y2ZmMTQ2Yg==
4
+ YjgyNWY0ZmU0NTFiNjg5MTVhZjVkYmFiODExZGEyYTNlODBjMjcxYQ==
5
5
  data.tar.gz: !binary |-
6
- NmU1OWZjMTliZWE3OGEyYWUzMGMyYzM5ZDgyNThjNjAxNTk5NzY2ZA==
6
+ ZTEwN2FmZGM4YWVkYTU3NmM3NmI0MWM0ZWY1MDlmMjViOTU1M2I0Yg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGJlYWMzMDYxZTUzODEyMjBhMzc3MDQ3NGFhZTA0YmNlMTcyZWM1MDZkOWQ3
10
- MDA3ODVkNmM3ODFmNDFmYmViNmIyNjQwNTU0OGNlOGFlZDFiNThjMmQ5ZjVi
11
- MjQ3N2FkMGNjY2ZiMDNiZThmNzVjYTQ4Mzk0Y2ZhNzJlYTc5M2I=
9
+ YWY0Y2I2MDNiNzIwMmE0OTIyMDhlMDdhZGQ0MTIyYjcyYTlhMTIxZmI5MWFh
10
+ ZmUzYTk2M2M2MjA4NDJmOWViYWIwZjUyYzZmYTlkZDMyMzI2MGZmN2Q3OWU0
11
+ ZWRmNjNkZDgzY2UxZDExZjcwNjg1ZDA1NzExN2I2MGI4YjlhODk=
12
12
  data.tar.gz: !binary |-
13
- ODJiOTE0YjhjZWRhNTM4NDM5YTdhZjk4MTIxZjQ0Mjg1NzA3NTBmNGExYWVj
14
- ZGVjMzcxMDRiYzFmZDc4MTMzN2E2MWFhODkzYWU3MDRmMDBiZjNiODQwNTdk
15
- MjM1YmE3Zjc2OTdiMmVjM2UyYzMzNTZkMzZjYjdiNjcwYzY1ZTA=
13
+ N2EwYjBkNTIzNzAxOWVjMDAxNTQwZDAyZmFkZjhiZWQwZmViZDAzOGMwODQ4
14
+ ZDZkNWY4MmMyMzdjY2NjMTlkYTIzZDI3OWE1OTFlMzU4MDFiMTIwMTVkNzI5
15
+ MjBjZmIyYTNhMmFmMjRiNDQ0ODM2MDkwZGE3MjAwNzJmNDgyZTI=
data/lib/ext/array.rb CHANGED
@@ -47,8 +47,16 @@ module Mobj
47
47
 
48
48
  alias_method :earliest, :return_first
49
49
 
50
- def msym
51
- map(&:sym)
50
+ def msym() map(&:sym) end
51
+
52
+ def apply(to)
53
+ map do |m|
54
+ if m.is_a?(Symbol)
55
+ to.send(m)
56
+ else
57
+ m.to_s.walk(to)
58
+ end
59
+ end
52
60
  end
53
61
 
54
62
  def meach(*args, &block)
@@ -26,6 +26,14 @@ module Mobj
26
26
 
27
27
  alias_method :alter, :wrap
28
28
 
29
+ def tru?(t=true, _=nil, &block)
30
+ block ? instance_exec(t, &block) : t
31
+ end
32
+
33
+ def fals?(*)
34
+ nil
35
+ end
36
+
29
37
  end
30
38
 
31
39
 
data/lib/ext/hash.rb CHANGED
@@ -4,6 +4,12 @@ module Mobj
4
4
 
5
5
  module HashEx
6
6
 
7
+ def apply!(obj)
8
+ map do |key, value|
9
+ obj.send(key, *value)
10
+ end
11
+ end
12
+
7
13
  def ki(name)
8
14
  name.to_s[/(.*?)[?!=]?$/, 1]
9
15
  end
data/lib/ext/nil.rb CHANGED
@@ -14,6 +14,18 @@ module Mobj
14
14
  true
15
15
  end
16
16
 
17
+ def tru?(_=nil, f=nil, &block)
18
+ f
19
+ end
20
+
21
+ def fals?(val=nil, &block)
22
+ if block
23
+ block.call(val)
24
+ else
25
+ val
26
+ end
27
+ end
28
+
17
29
  def null?(*)
18
30
  @@null ||= nil
19
31
  @@null && @@null == __mobj__caller
data/lib/ext/proc.rb ADDED
@@ -0,0 +1,9 @@
1
+ module Mobj
2
+
3
+ class ::Proc
4
+ def <=(arg) call(arg) end
5
+ def <<(arg) call(arg) end
6
+ def <(arg) call(arg) end
7
+ end
8
+
9
+ end
data/lib/mobj.rb CHANGED
@@ -43,7 +43,7 @@ module Mobj
43
43
  path.map { |pth| obj[pth.sym] }
44
44
  elsif path[0] == '*' && obj.respond_to?(path[1..-1].sym)
45
45
  obj.__send__(path[1..-1].sym)
46
- elsif obj.respond_to? :[]
46
+ elsif obj.respond_to?(:[]) && (obj.is_a?(Hash) || path.to_s =~ /[0-9.-]+/)
47
47
  if obj.is_a?(Hash)
48
48
  obj[path.sym]
49
49
  else
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: 2.9.6
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Mason
7
+ - Mason Glaves
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-09 00:00:00.000000000 Z
11
+ date: 2013-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rr
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ! '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: awesome_print
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +38,9 @@ dependencies:
52
38
  - - ! '>='
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
- description: Utils and extentions for various ruby objects
41
+ description: ! 'Utils and extentions for various ruby objects
42
+
43
+ '
56
44
  email: mobj@chipped.net
57
45
  executables: []
58
46
  extensions: []
@@ -67,6 +55,7 @@ files:
67
55
  - lib/ext/match_data.rb
68
56
  - lib/ext/nil.rb
69
57
  - lib/ext/object.rb
58
+ - lib/ext/proc.rb
70
59
  - lib/ext/string.rb
71
60
  - lib/ext/symbol.rb
72
61
  - lib/mobj.rb