hash-utils 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/TODO.txt CHANGED
@@ -1,2 +1,3 @@
1
1
  * add examples to each call
2
2
  * puts list of methods directly to readme for each class
3
+ * changes list
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.7.0
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+ # (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
3
+
4
+ ##
5
+ # Object extension.
6
+ #
7
+
8
+ class Object
9
+ ##
10
+ # Converts object to Boolean according to Ruby conversion rules.
11
+ #
12
+ # @return [Boolean] +true+ or +false+
13
+ # @since 0.7.0
14
+ #
15
+
16
+ def to_b
17
+ !!self
18
+ end
19
+ end
@@ -133,20 +133,20 @@ class String
133
133
  #
134
134
 
135
135
  def map(&block)
136
- buffer = ""
137
- self.each_char do |ch|
138
- buffer << block.call(ch)
136
+ buffer = " " * self.length
137
+ self.length.times do |i|
138
+ buffer[i] = block.call(self[i])
139
139
  end
140
-
140
+
141
141
  return buffer
142
142
  end
143
143
 
144
144
  ##
145
145
  # Applies block to each character in place. For example see {#map}.
146
- # @since 0.6.0
147
146
  #
148
147
  # @param [Proc] block transforming block
149
148
  # @return [String] self
149
+ # @since 0.6.0
150
150
  # @see #map
151
151
  #
152
152
 
data/test ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.push("./lib")
4
+ require "hash-utils/string"
5
+ foo = "012"
6
+
7
+ puts foo.to_a.inspect
8
+ puts foo.map { |ch| (ch.to_i + 1).to_s }.inspect
9
+
10
+ foo.map! { |ch| (ch.to_i + 1).to_s }
11
+ puts foo.inspect
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hash-utils
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.0
5
+ version: 0.7.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-02-09 00:00:00 +01:00
13
+ date: 2011-02-10 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -53,13 +53,14 @@ files:
53
53
  - Rakefile
54
54
  - TODO.txt
55
55
  - VERSION
56
- - hash-utils.gemspec
57
56
  - lib/hash-utils.rb
58
57
  - lib/hash-utils/array.rb
59
58
  - lib/hash-utils/hash.rb
60
59
  - lib/hash-utils/numeric.rb
60
+ - lib/hash-utils/object.rb
61
61
  - lib/hash-utils/string.rb
62
62
  - lib/hash-utils/symbol.rb
63
+ - test
63
64
  has_rdoc: true
64
65
  homepage: http://github.com/martinkozak/hash-utils
65
66
  licenses:
@@ -74,7 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
75
  requirements:
75
76
  - - ">="
76
77
  - !ruby/object:Gem::Version
77
- hash: -3314318327332917166
78
+ hash: 70380949800056632
78
79
  segments:
79
80
  - 0
80
81
  version: "0"
data/hash-utils.gemspec DELETED
@@ -1,56 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{hash-utils}
8
- s.version = "0.6.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Martin Kozák"]
12
- s.date = %q{2011-02-09}
13
- s.email = %q{martinkozak@martinkozak.net}
14
- s.extra_rdoc_files = [
15
- "LICENSE.txt",
16
- "README.md"
17
- ]
18
- s.files = [
19
- ".document",
20
- "Gemfile",
21
- "Gemfile.lock",
22
- "LICENSE.txt",
23
- "README.md",
24
- "Rakefile",
25
- "TODO.txt",
26
- "VERSION",
27
- "hash-utils.gemspec",
28
- "lib/hash-utils.rb",
29
- "lib/hash-utils/array.rb",
30
- "lib/hash-utils/hash.rb",
31
- "lib/hash-utils/numeric.rb",
32
- "lib/hash-utils/string.rb",
33
- "lib/hash-utils/symbol.rb"
34
- ]
35
- s.homepage = %q{http://github.com/martinkozak/hash-utils}
36
- s.licenses = ["MIT"]
37
- s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.5.0}
39
- s.summary = %q{Adds a lot of useful fundamental utility methods which are missing in Ruby, both to Array and Hash classes and introduces some useful methods and syntactic sugar to Numeric, Symbol and String classes too.}
40
-
41
- if s.respond_to? :specification_version then
42
- s.specification_version = 3
43
-
44
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
46
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
47
- else
48
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
49
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
50
- end
51
- else
52
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
53
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
54
- end
55
- end
56
-