utilise 0.3.0 → 0.4.0.pre.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ffd0c3562b22e97cc84ba93b62b4d239fc354b87
4
- data.tar.gz: f75f9b64fc7b58c25e758905ca78355809daf20f
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGM5MTE4M2VhMWJiY2FlMTkyZjE2YjA3MDcwOGM0YjM3MTQ3ZTYyNQ==
5
+ data.tar.gz: !binary |-
6
+ ZWIxZjZjNDUzYWU4YmQwMzQzYjU4NzhiZWY5OGE5ZmMwZDhhMmE4NA==
5
7
  SHA512:
6
- metadata.gz: 34a3b0e75e041970e5e532d72a91eebc6f3495bef32d2b70a352a37aa3bdad2fc38c2d408e4796959bf58629c33cc004114feae460ac2ef2bd41d1f6b0e559c2
7
- data.tar.gz: 1a41372a0e82fdfda4dab02d19240d8b4d5e17c51258efa3d74d1e1bd42bbc70335ee49828f9b626b93f897ef21ef6c599c57bcfc2efef0be3ac065fa4b9d582
8
+ metadata.gz: !binary |-
9
+ MzVjZjgyNzk0MWU3YTgzNzdlNWI0ZjczNjI1ZTExODExYWY1ODAyNjJlNTNm
10
+ ZTU2YzM4NGFmMzExODJlMmU2Yzg3MzVlMzRkZGI1MDQzYjgxMTkxYTMxZmJj
11
+ ZjdhY2YyOGM5YzRlM2MyNDJlYTIxZDQ3MjI0NzdhOTgyMmUyZDk=
12
+ data.tar.gz: !binary |-
13
+ N2U4NTRmMjdlZDFlNzM5YzJlNDQ2ODFiZTVlYjc5YjllNDlkMjllM2RkZTBm
14
+ NTRiMTFkMzQ5NTM0YWY3Y2Y1ZjdlODhhNDFlM2U5MThjYzczYWNjYmNjN2Q5
15
+ MTNjMThkZjkxNDI5YWI3NWY2NGUxMGFjMzJmOTZjZTE0MmYzZWY=
@@ -0,0 +1,56 @@
1
+ module Utilise
2
+ module Augment
3
+ module Bool
4
+
5
+ # Returns bool based on object passed
6
+ #
7
+ # @param object [Object] the object
8
+ # @return [Object] returns object boolean
9
+ def to_bool object = self
10
+ case object
11
+ when String, Fixnum, Symbol
12
+ bool_it object
13
+ when Hash
14
+ bool_hash object
15
+ when Array
16
+ bool_array object
17
+ end
18
+ end
19
+
20
+ # Iterates through hash and updates each key
21
+ # value to a boolean if it matches rules
22
+ #
23
+ # @param hash [Hash] the hash
24
+ def bool_hash hash
25
+ hash.each do |k,v|
26
+ val = to_bool(hash[k])
27
+ hash[k] = val unless val.nil?
28
+ end
29
+ end
30
+
31
+ # Iterates through array and updates each
32
+ # element to a boolean if it matches rules
33
+ #
34
+ # @param array [Array] the array
35
+ def bool_array array
36
+ array.each_index do |i|
37
+ val = to_bool(array[i])
38
+ array[i] = val unless val.nil?
39
+ end
40
+ end
41
+
42
+ # Returns boolean value if object matches rules
43
+ #
44
+ # @param array [Array] the array
45
+ # @returns [Boolean] true/false returned
46
+ def bool_it object
47
+ case object.to_s
48
+ when /^true$/i, /^yes$/i, /^t$/i, /^1$/i
49
+ true
50
+ when /^false$/i, /^no$/i, /^f$/i, /^0$/i
51
+ false
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,9 @@
1
+ module Utilise
2
+ module Augment
3
+ module Matchers
4
+ def is_bool?
5
+ self.is_a?(TrueClass) || self.is_a?(FalseClass)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Utilise
2
+ module Augment
3
+ module Time
4
+ def unique
5
+ self.now.strftime("%s%3N")[-8..-1]
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,31 @@
1
+ require 'utilise/augment/bool.rb'
2
+ require 'utilise/augment/matchers.rb'
3
+ require 'utilise/augment/time.rb'
4
+
5
+ class String
6
+ include Utilise::Augment::Bool
7
+ end
8
+
9
+ class Fixnum
10
+ include Utilise::Augment::Bool
11
+ end
12
+
13
+ class Symbol
14
+ include Utilise::Augment::Bool
15
+ end
16
+
17
+ class Object
18
+ include Utilise::Augment::Matchers
19
+ end
20
+
21
+ class Time
22
+ extend Utilise::Augment::Time
23
+ end
24
+
25
+ class Hash
26
+ include Utilise::Augment::Bool
27
+ end
28
+
29
+ class Array
30
+ include Utilise::Augment::Bool
31
+ end
@@ -1,4 +1,4 @@
1
1
  module Utilise
2
- VERSION = "0.3.0".freeze
3
- DATE = "2013-12-02".freeze
4
- end
2
+ VERSION = "0.4.0".freeze
3
+ DATE = "2014-07-04".freeze
4
+ end
data/lib/utilise.rb CHANGED
@@ -1,32 +1,2 @@
1
- require 'utilise/bool.rb'
2
- require 'utilise/matchers.rb'
3
- require 'utilise/time.rb'
1
+ require 'utilise/augment.rb'
4
2
  require 'utilise/version.rb'
5
-
6
- class String
7
- include Utilise::Bool
8
- end
9
-
10
- class Fixnum
11
- include Utilise::Bool
12
- end
13
-
14
- class Symbol
15
- include Utilise::Bool
16
- end
17
-
18
- class Object
19
- include Utilise::Matchers
20
- end
21
-
22
- class Time
23
- extend Utilise::Time
24
- end
25
-
26
- class Hash
27
- include Utilise::Bool
28
- end
29
-
30
- class Array
31
- include Utilise::Bool
32
- end
data/spec/helper.rb CHANGED
@@ -4,6 +4,5 @@ Coveralls.wear!
4
4
  require 'utilise'
5
5
 
6
6
  RSpec.configure do |config|
7
- config.color_enabled = true
8
7
  config.formatter = :documentation
9
- end
8
+ end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utilise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0.pre.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Slaughter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-02 00:00:00.000000000 Z
11
+ date: 2014-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
@@ -66,27 +66,28 @@ dependencies:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.13.0
69
- description: 'Extends a few ruby classes with helpful tools, currently: X.to_bool'
69
+ description: ! 'Extends a few ruby classes with helpful tools, currently: X.to_bool'
70
70
  email: b.p.slaughter@gmail.com
71
71
  executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []
74
74
  files:
75
- - README.md
76
75
  - License.md
77
- - lib/utilise/bool.rb
78
- - lib/utilise/matchers.rb
79
- - lib/utilise/time.rb
80
- - lib/utilise/version.rb
76
+ - README.md
81
77
  - lib/utilise.rb
82
- - spec/array_spec.rb
83
- - spec/fixnum_spec.rb
84
- - spec/hash_spec.rb
78
+ - lib/utilise/augment.rb
79
+ - lib/utilise/augment/bool.rb
80
+ - lib/utilise/augment/matchers.rb
81
+ - lib/utilise/augment/time.rb
82
+ - lib/utilise/version.rb
83
+ - spec/augment/array_spec.rb
84
+ - spec/augment/fixnum_spec.rb
85
+ - spec/augment/hash_spec.rb
86
+ - spec/augment/object_spec.rb
87
+ - spec/augment/string_spec.rb
88
+ - spec/augment/symbol_spec.rb
89
+ - spec/augment/time_spec.rb
85
90
  - spec/helper.rb
86
- - spec/object_spec.rb
87
- - spec/string_spec.rb
88
- - spec/symbol_spec.rb
89
- - spec/time_spec.rb
90
91
  homepage: http://benslaughter.github.io/utilise/
91
92
  licenses:
92
93
  - MIT
@@ -97,27 +98,26 @@ require_paths:
97
98
  - lib
98
99
  required_ruby_version: !ruby/object:Gem::Requirement
99
100
  requirements:
100
- - - '>='
101
+ - - ! '>='
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
103
104
  required_rubygems_version: !ruby/object:Gem::Requirement
104
105
  requirements:
105
- - - '>='
106
+ - - ! '>'
106
107
  - !ruby/object:Gem::Version
107
- version: '0'
108
+ version: 1.3.1
108
109
  requirements: []
109
110
  rubyforge_project:
110
- rubygems_version: 2.0.3
111
+ rubygems_version: 2.2.2
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: Utilises a few extra tools
114
115
  test_files:
115
- - spec/array_spec.rb
116
- - spec/fixnum_spec.rb
117
- - spec/hash_spec.rb
116
+ - spec/augment/object_spec.rb
117
+ - spec/augment/string_spec.rb
118
+ - spec/augment/symbol_spec.rb
119
+ - spec/augment/time_spec.rb
120
+ - spec/augment/hash_spec.rb
121
+ - spec/augment/array_spec.rb
122
+ - spec/augment/fixnum_spec.rb
118
123
  - spec/helper.rb
119
- - spec/object_spec.rb
120
- - spec/string_spec.rb
121
- - spec/symbol_spec.rb
122
- - spec/time_spec.rb
123
- has_rdoc:
data/lib/utilise/bool.rb DELETED
@@ -1,55 +0,0 @@
1
- module Utilise
2
- module Bool
3
-
4
- # Returns bool based on object passed
5
- #
6
- # @param object [Object] the object
7
- # @return [Object] returns object boolean
8
- def to_bool object = self
9
- case object
10
- when String, Fixnum, Symbol
11
- bool_it object
12
- when Hash
13
- bool_hash object
14
- when Array
15
- bool_array object
16
- end
17
- end
18
-
19
- # Iterates through hash and updates each key
20
- # value to a boolean if it matches rules
21
- #
22
- # @param hash [Hash] the hash
23
- def bool_hash hash
24
- hash.each do |k,v|
25
- val = to_bool(hash[k])
26
- hash[k] = val unless val.nil?
27
- end
28
- end
29
-
30
- # Iterates through array and updates each
31
- # element to a boolean if it matches rules
32
- #
33
- # @param array [Array] the array
34
- def bool_array array
35
- array.each_index do |i|
36
- val = to_bool(array[i])
37
- array[i] = val unless val.nil?
38
- end
39
- end
40
-
41
- # Returns boolean value if object matches rules
42
- #
43
- # @param array [Array] the array
44
- # @returns [Boolean] true/false returned
45
- def bool_it object
46
- case object.to_s
47
- when /^true$/i, /^yes$/i, /^t$/i, /^1$/i
48
- true
49
- when /^false$/i, /^no$/i, /^f$/i, /^0$/i
50
- false
51
- end
52
- end
53
-
54
- end
55
- end
@@ -1,7 +0,0 @@
1
- module Utilise
2
- module Matchers
3
- def is_bool?
4
- self.is_a?(TrueClass) || self.is_a?(FalseClass)
5
- end
6
- end
7
- end
data/lib/utilise/time.rb DELETED
@@ -1,7 +0,0 @@
1
- module Utilise
2
- module Time
3
- def unique
4
- self.now.strftime("%s%3N")[-8..-1]
5
- end
6
- end
7
- end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes