hammock 0.2.24 → 0.2.25
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/hammock.gemspec +2 -2
- data/lib/hammock/monkey_patches/active_record.rb +4 -0
- data/lib/hammock/monkey_patches/string.rb +11 -0
- data/lib/hammock/restful_support.rb +0 -6
- data/lib/hammock.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 0.2.25 2009-05-25
|
2
|
+
Added String#clean_email[!].
|
3
|
+
Moved set_new_or_deleted_before_save callback from controller to model.
|
4
|
+
|
5
|
+
|
1
6
|
== 0.2.24 2009-05-05
|
2
7
|
Removed two unused methods from active_record patches.
|
3
8
|
Renamed find_with_deleted to find_with_destroyed in #find_or_new_with, for acts_as_paranoid -> is_paranoid.
|
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.2.
|
5
|
+
s.version = "0.2.25"
|
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-05-
|
9
|
+
s.date = %q{2009-05-25}
|
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
|
|
@@ -10,6 +10,10 @@ module Hammock
|
|
10
10
|
MixInto.define_callbacks callback_name
|
11
11
|
# base.send :define_method, callback_name, lambda { }
|
12
12
|
}
|
13
|
+
base.class_eval {
|
14
|
+
before_create :set_new_or_deleted_before_save
|
15
|
+
before_undestroy :set_new_or_deleted_before_save
|
16
|
+
}
|
13
17
|
end
|
14
18
|
|
15
19
|
module ClassMethods
|
@@ -136,6 +136,17 @@ module Hammock
|
|
136
136
|
/^([a-z0-9\-\+\_\.]{2,})\@([a-z0-9\-]+\.)*([a-z0-9\-]{2,}\.)([a-z0-9\-]{2,})$/ =~ self
|
137
137
|
end
|
138
138
|
|
139
|
+
def clean_email!
|
140
|
+
strip!
|
141
|
+
downcase!
|
142
|
+
gsub! 'mailto:', ''
|
143
|
+
strip!
|
144
|
+
self
|
145
|
+
end
|
146
|
+
def clean_email
|
147
|
+
dup.clean_email!
|
148
|
+
end
|
149
|
+
|
139
150
|
def colorize description = '', start_at = nil
|
140
151
|
if start_at.nil? || (cut_point = index(start_at)).nil?
|
141
152
|
Colorizer.colorize self, description
|
@@ -9,8 +9,6 @@ module Hammock
|
|
9
9
|
# TODO Investigate the usefulness of this.
|
10
10
|
# before_destroy :set_editing
|
11
11
|
before_create :set_creator_id_if_appropriate
|
12
|
-
before_create :set_new_or_deleted_before_save
|
13
|
-
before_undestroy :set_new_or_deleted_before_save
|
14
12
|
helper_method :mdl, :mdl_name, :editing?, :nested_within?, :partial_exists?
|
15
13
|
}
|
16
14
|
end
|
@@ -153,10 +151,6 @@ module Hammock
|
|
153
151
|
@editing = @record
|
154
152
|
end
|
155
153
|
|
156
|
-
def set_new_or_deleted_before_save
|
157
|
-
@record.set_new_or_deleted_before_save
|
158
|
-
end
|
159
|
-
|
160
154
|
# TODO process /^creating_\w+_id$/ as well
|
161
155
|
def set_creator_id_if_appropriate
|
162
156
|
if @record.respond_to? :creator_id=
|
data/lib/hammock.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.25
|
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-05-
|
12
|
+
date: 2009-05-25 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|