hash-utils 0.13.1 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,9 +10,11 @@ non-atomic and organized by better way.
10
10
  - `Array` – 3 methods,
11
11
  - `File` – 2 methods,
12
12
  - `Hash` – 30 methods,
13
+ - `IO` – 1 method,
13
14
  - `Module` – 1 method,
14
- - `Object` – 3 methods,
15
+ - `Object` – 4 methods,
15
16
  - `String` – 23 methods,
17
+ - `StringIO` – 1 method,
16
18
  - `Symbol` – 7 methods.
17
19
 
18
20
  For full reference and methods lists, see **[documentation][3]**.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.13.1
1
+ 0.14.0
data/hash-utils.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hash-utils}
8
- s.version = "0.13.1"
8
+ s.version = "0.14.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Martin Kozák"]
12
- s.date = %q{2011-03-24}
12
+ s.date = %q{2011-03-25}
13
13
  s.email = %q{martinkozak@martinkozak.net}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
@@ -29,10 +29,12 @@ Gem::Specification.new do |s|
29
29
  "lib/hash-utils/array.rb",
30
30
  "lib/hash-utils/file.rb",
31
31
  "lib/hash-utils/hash.rb",
32
+ "lib/hash-utils/io.rb",
32
33
  "lib/hash-utils/module.rb",
33
34
  "lib/hash-utils/numeric.rb",
34
35
  "lib/hash-utils/object.rb",
35
36
  "lib/hash-utils/string.rb",
37
+ "lib/hash-utils/stringio.rb",
36
38
  "lib/hash-utils/symbol.rb",
37
39
  "test"
38
40
  ]
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
3
+
4
+ ##
5
+ # IO extension.
6
+ #
7
+
8
+ class IO
9
+
10
+ ##
11
+ # Indicates, object is IO, so +IO+ or +StringIO+ class.
12
+ #
13
+ # @return [Boolean] +true+ if yes, +false+ in otherwise
14
+ # @since 0.14.0
15
+ #
16
+
17
+ def io?
18
+ true
19
+ end
20
+
21
+ end
@@ -44,4 +44,15 @@ class Object
44
44
  return result
45
45
  end
46
46
 
47
+ ##
48
+ # Indicates, object is IO, so +IO+ or +StringIO+ class.
49
+ #
50
+ # @return [Boolean] +true+ if yes, +false+ in otherwise
51
+ # @since 0.14.0
52
+ #
53
+
54
+ def io?
55
+ false
56
+ end
57
+
47
58
  end
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
3
+
4
+ ##
5
+ # StringIO extension.
6
+ #
7
+
8
+ class StringIO
9
+
10
+ ##
11
+ # Indicates, object is IO, so +IO+ or +StringIO+ class.
12
+ #
13
+ # @return [Boolean] +true+ if yes, +false+ in otherwise
14
+ # @since 0.14.0
15
+ #
16
+
17
+ def io?
18
+ true
19
+ end
20
+
21
+ end
data/lib/hash-utils.rb CHANGED
@@ -4,7 +4,9 @@
4
4
  require "hash-utils/array"
5
5
  require "hash-utils/file"
6
6
  require "hash-utils/hash"
7
+ require "hash-utils/io"
7
8
  require "hash-utils/module"
8
9
  require "hash-utils/object"
9
10
  require "hash-utils/string"
11
+ require "hash-utils/stringio"
10
12
  require "hash-utils/symbol"
data/test CHANGED
@@ -3,6 +3,7 @@
3
3
  # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
4
4
 
5
5
  $:.push("./lib")
6
+ require "stringio"
6
7
  require "hash-utils"
7
8
  require "riot"
8
9
 
@@ -68,6 +69,20 @@ context "Hash" do
68
69
  end
69
70
  end
70
71
 
72
+ ## IO
73
+
74
+ context "IO" do
75
+ asserts("#io?") do
76
+ io = File::open("./~test", "w")
77
+ result = io.io?
78
+ io.close()
79
+ result
80
+ end
81
+ teardown do
82
+ File.unlink("./~test")
83
+ end
84
+ end
85
+
71
86
  ## MODULE
72
87
 
73
88
  context "Module" do
@@ -86,6 +101,9 @@ context "Object" do
86
101
  asserts("#in?") do
87
102
  5.in? 1..7
88
103
  end
104
+ asserts("#io?") do
105
+ not "".io?
106
+ end
89
107
  asserts("#to_b") do
90
108
  (nil.to_b === false) and ("ab".to_b === true)
91
109
  end
@@ -196,6 +214,14 @@ context "String" do
196
214
 
197
215
  end
198
216
 
217
+ ## STRINGIO
218
+
219
+ context "StringIO" do
220
+ asserts("#io?") do
221
+ StringIO::new.io?
222
+ end
223
+ end
224
+
199
225
  ## SYMBOL
200
226
 
201
227
  context "Symbol" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hash-utils
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.13.1
5
+ version: 0.14.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Martin Koz\xC3\xA1k"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-24 00:00:00 +01:00
13
+ date: 2011-03-25 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -69,10 +69,12 @@ files:
69
69
  - lib/hash-utils/array.rb
70
70
  - lib/hash-utils/file.rb
71
71
  - lib/hash-utils/hash.rb
72
+ - lib/hash-utils/io.rb
72
73
  - lib/hash-utils/module.rb
73
74
  - lib/hash-utils/numeric.rb
74
75
  - lib/hash-utils/object.rb
75
76
  - lib/hash-utils/string.rb
77
+ - lib/hash-utils/stringio.rb
76
78
  - lib/hash-utils/symbol.rb
77
79
  - test
78
80
  has_rdoc: true
@@ -93,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
95
  requirements:
94
96
  - - ">="
95
97
  - !ruby/object:Gem::Version
96
- hash: -246920346278119187
98
+ hash: -2177063617848382598
97
99
  segments:
98
100
  - 0
99
101
  version: "0"