hammock 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.3.12 2009-09-09
2
+ Added Method#yield_until.
3
+ Updated String.azAZ09 to exclude vowels.
4
+ Added Array#rand.
5
+ Use Rails.logger instead of logger, so it works everywhere.
6
+
7
+
1
8
  == 0.3.11 2009-08-19
2
9
  Removed some old debug logging.
3
10
  Added String#quote_for_shell.
data/hammock.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hammock}
5
- s.version = "0.3.11"
5
+ s.version = "0.3.12"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ben Hoskings"]
9
- s.date = %q{2009-08-19}
9
+ s.date = %q{2009-09-09}
10
10
  s.description = %q{Hammock is a Rails plugin that eliminates redundant code in a very RESTful manner. It does this in lots in lots of different places, but in one manner: it encourages specification in place of implementation.
11
11
 
12
12
 
@@ -34,15 +34,15 @@ It makes more sense when you see how it works though. There's a screencast comin
34
34
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
35
35
  s.add_runtime_dependency(%q<rails>, ["~> 2.2"])
36
36
  s.add_runtime_dependency(%q<benhoskings-ambitious-activerecord>, ["~> 0.1.3.7"])
37
- s.add_development_dependency(%q<hoe>, [">= 2.3.2"])
37
+ s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
38
38
  else
39
39
  s.add_dependency(%q<rails>, ["~> 2.2"])
40
40
  s.add_dependency(%q<benhoskings-ambitious-activerecord>, ["~> 0.1.3.7"])
41
- s.add_dependency(%q<hoe>, [">= 2.3.2"])
41
+ s.add_dependency(%q<hoe>, [">= 2.3.3"])
42
42
  end
43
43
  else
44
44
  s.add_dependency(%q<rails>, ["~> 2.2"])
45
45
  s.add_dependency(%q<benhoskings-ambitious-activerecord>, ["~> 0.1.3.7"])
46
- s.add_dependency(%q<hoe>, [">= 2.3.2"])
46
+ s.add_dependency(%q<hoe>, [">= 2.3.3"])
47
47
  end
48
48
  end
@@ -89,7 +89,7 @@ module Hammock
89
89
  callpoint = caller[opts[:skip]].sub(rails_root.end_with('/'), '')
90
90
  entry = "#{callpoint}#{msg.blank? ? (opts[:report] ? ' <-- something broke here' : '.') : ' | '}#{msg}"
91
91
 
92
- logger.send opts[:error].blank? ? :info : :error, entry # Write to the Rails log
92
+ Rails.logger.send opts[:error].blank? ? :info : :error, entry # Write to the Rails log
93
93
  log_concise entry, opts[:report] # Also write to the concise log
94
94
  end
95
95
 
@@ -28,6 +28,10 @@ module Hammock
28
28
  value
29
29
  end
30
30
 
31
+ def rand
32
+ self[Kernel.rand(length)]
33
+ end
34
+
31
35
  def squash
32
36
  dup.squash!
33
37
  end
@@ -8,6 +8,9 @@ module Hammock
8
8
  end
9
9
 
10
10
  module ClassMethods
11
+ AZ09Chars = ('0'..'9').to_a +
12
+ (('a'..'z').to_a - %w[a e i o u]) +
13
+ (('A'..'Z').to_a - %w[A E I O U])
11
14
 
12
15
  # Generates a random string consisting of +length+ hexadecimal characters (i.e. matching [0-9a-f]{length}).
13
16
  def af09 length = 1
@@ -18,11 +21,8 @@ module Hammock
18
21
 
19
22
  # Generates a random string consisting of +length+ alphamuneric characters (i.e. matching [0-9a-zA-Z]{length}).
20
23
  def azAZ09 length = 1
21
- (1..length).inject('') {|a, t|
22
- a << ((r = rand(62)) < 36 ? r.to_s(36) : (r - 26).to_s(36).upcase)
23
- }
24
+ (1..length).inject('') {|a, t| a << AZ09Chars.rand }
24
25
  end
25
-
26
26
  end
27
27
 
28
28
  module InstanceMethods
data/lib/hammock.rb CHANGED
@@ -4,7 +4,7 @@ require 'ambition'
4
4
  require 'ambition/adapters/active_record'
5
5
 
6
6
  module Hammock
7
- VERSION = '0.3.11'
7
+ VERSION = '0.3.12'
8
8
  IncludeTarget = ActionController::Base
9
9
 
10
10
  def self.included base # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Hoskings
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-19 00:00:00 +10:00
12
+ date: 2009-09-09 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 2.3.2
43
+ version: 2.3.3
44
44
  version:
45
45
  description: |-
46
46
  Hammock is a Rails plugin that eliminates redundant code in a very RESTful manner. It does this in lots in lots of different places, but in one manner: it encourages specification in place of implementation.