date_filter 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *~
6
+ *swp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in date_filter.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011, Anthony Lewis
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
20
+
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # date_filter
2
+
3
+ This is basically the simplest rails plugin ever. It is mainly an example of creating your own Rails plugins.
4
+
5
+ DateFilter adds `newest` and `oldest` methods to ActiveRecord. These methods are used like `first` and `last` except they are automatically orded by `created_at`.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "date_filter/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "date_filter"
7
+ s.version = DateFilter::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Anthony Lewis"]
10
+ s.email = ["me@anthonylewis.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Adds newest and oldest methods to ActiveRecord}
13
+ s.description = %q{Adds newest and oldest methods to ActiveRecord}
14
+
15
+ s.rubyforge_project = "date_filter"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
@@ -0,0 +1,12 @@
1
+
2
+ require 'active_support'
3
+ require 'active_record'
4
+ require 'date_filter/extensions'
5
+
6
+ module DateFilter
7
+ end
8
+
9
+ ActiveSupport.on_load(:active_record) do
10
+ include DateFilter::Extensions
11
+ end
12
+
@@ -0,0 +1,19 @@
1
+
2
+ module DateFilter
3
+ module Extensions
4
+ def self.included(base)
5
+ base.send :extend, ClassMethods
6
+ end
7
+
8
+ module ClassMethods
9
+ def newest
10
+ order('created_at DESC').first
11
+ end
12
+
13
+ def oldest
14
+ order('created_at ASC').first
15
+ end
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,3 @@
1
+ module DateFilter
2
+ VERSION = "0.9.0"
3
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: date_filter
3
+ version: !ruby/object:Gem::Version
4
+ hash: 59
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 9
9
+ - 0
10
+ version: 0.9.0
11
+ platform: ruby
12
+ authors:
13
+ - Anthony Lewis
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-04-20 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Adds newest and oldest methods to ActiveRecord
23
+ email:
24
+ - me@anthonylewis.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - date_filter.gemspec
38
+ - lib/date_filter.rb
39
+ - lib/date_filter/extensions.rb
40
+ - lib/date_filter/version.rb
41
+ has_rdoc: true
42
+ homepage: ""
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project: date_filter
71
+ rubygems_version: 1.3.7
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Adds newest and oldest methods to ActiveRecord
75
+ test_files: []
76
+