searchable_record 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +5 -0
- data/Manifest +2 -2
- data/README.rdoc +1 -1
- data/lib/searchable_record/core.rb +13 -13
- data/lib/searchable_record/version.rb +2 -2
- data/lib/searchable_record.rb +1 -1
- data/searchable_record.gemspec +3 -3
- data/spec/{searchable_record_spec.rb → core_spec.rb} +0 -0
- data/spec/searchable_record_spec_helper.rb +3 -1
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/Manifest
CHANGED
@@ -3,9 +3,9 @@ lib/searchable_record/core.rb
|
|
3
3
|
lib/searchable_record/util.rb
|
4
4
|
lib/searchable_record/version.rb
|
5
5
|
lib/searchable_record.rb
|
6
|
-
Manifest
|
7
6
|
Rakefile
|
8
7
|
README.rdoc
|
9
|
-
spec/
|
8
|
+
spec/core_spec.rb
|
10
9
|
spec/searchable_record_spec_helper.rb
|
11
10
|
spec/util_spec.rb
|
11
|
+
Manifest
|
data/README.rdoc
CHANGED
@@ -143,7 +143,7 @@ com >.
|
|
143
143
|
|
144
144
|
This software is licensed under the terms of the "MIT license":
|
145
145
|
|
146
|
-
Copyright (c) 2008
|
146
|
+
Copyright (c) 2008, 2009 Tuomas Kareinen
|
147
147
|
|
148
148
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
149
149
|
of this software and associated documentation files (the "Software"), to
|
@@ -27,7 +27,7 @@ module SearchableRecord
|
|
27
27
|
# records that match to specific patterns.
|
28
28
|
#
|
29
29
|
# What the client user is allowed to query is defined by specific rules
|
30
|
-
# passed to the method as a
|
30
|
+
# passed to the method as a hash argument. Query parameters that are not
|
31
31
|
# explicitly stated in the rules are silently discarded.
|
32
32
|
#
|
33
33
|
# Essentially, the method is a frontend for
|
@@ -39,7 +39,7 @@ module SearchableRecord
|
|
39
39
|
#
|
40
40
|
# ==== Parsing rules
|
41
41
|
#
|
42
|
-
# The parsing rules must be given as a
|
42
|
+
# The parsing rules must be given as a hash. The recognized keys are the
|
43
43
|
# following:
|
44
44
|
#
|
45
45
|
# * <tt>:limit</tt>, allowing limiting the number of matching items
|
@@ -52,9 +52,9 @@ module SearchableRecord
|
|
52
52
|
# integer value.
|
53
53
|
# * <tt>:sort</tt>, which determines the ordering of matching items
|
54
54
|
# (the same effect as with the <tt>:order</tt> option of
|
55
|
-
# <tt>find</tt>). The value is a
|
55
|
+
# <tt>find</tt>). The value is a hash of
|
56
56
|
# <tt>"<parameter_value>" => "<table>.<column>"</tt> pairs. The rule
|
57
|
-
# enables query parameter "sort" that accepts keys from the
|
57
|
+
# enables query parameter "sort" that accepts keys from the hash as
|
58
58
|
# its legal values.
|
59
59
|
# * <tt>:rsort</tt>, for reverse sort. Uses the rules of
|
60
60
|
# <tt>:sort</tt>; thus, use +nil+ as the value if you want to enable
|
@@ -62,18 +62,18 @@ module SearchableRecord
|
|
62
62
|
# * <tt>:since</tt>, which sets a lower timedate limit. The value is
|
63
63
|
# either a string naming the database table column that has
|
64
64
|
# timestamps (using the type from default settings'
|
65
|
-
# <tt>:cast_since_as</tt> entry) or a
|
65
|
+
# <tt>:cast_since_as</tt> entry) or a hash that contains entries like
|
66
66
|
# <tt>:column => "<table>.<column>"</tt> and
|
67
67
|
# <tt>:cast_as => "<sql_timedate_type>"</tt>. The rule enables query
|
68
68
|
# parameter "since" that accepts timedate values.
|
69
69
|
# * <tt>:until</tt>, which sets an upper timedate limit. It is used
|
70
70
|
# like <tt>:since</tt>.
|
71
|
-
# * <tt>:patterns</tt>, where the value is a
|
72
|
-
# The keys in the
|
71
|
+
# * <tt>:patterns</tt>, where the value is a hash containing patterns.
|
72
|
+
# The keys in the hash correspond to additional query parameters,
|
73
73
|
# while the corresponding values to the keys correspond to database
|
74
74
|
# table columns. For each pattern, the value is either directly a
|
75
|
-
# string, or a
|
76
|
-
# <tt>:column => "<table>.<column>"</tt>. A pattern's
|
75
|
+
# string, or a hash containing an entry like
|
76
|
+
# <tt>:column => "<table>.<column>"</tt>. A pattern's hash may
|
77
77
|
# contain two optional entries in addition to <tt>:column</tt>:
|
78
78
|
# <tt>:converter => lambda { |val| <conversion_operation_for_val> }</tt>
|
79
79
|
# and <tt>:operator => "<sql_pattern_operator>"</tt>.
|
@@ -99,7 +99,7 @@ module SearchableRecord
|
|
99
99
|
#
|
100
100
|
# The default settings for the rules are accessible and modifiable by
|
101
101
|
# calling the method +searchable_record_settings+. The settings are
|
102
|
-
# stored as a
|
102
|
+
# stored as a hash; the following keys are recognized:
|
103
103
|
#
|
104
104
|
# * <tt>:cast_since_as</tt>,
|
105
105
|
# * <tt>:cast_until_as</tt>,
|
@@ -111,8 +111,8 @@ module SearchableRecord
|
|
111
111
|
# === Arguments
|
112
112
|
#
|
113
113
|
# +extend+:: The same as the first argument to <tt>find</tt> (such as <tt>:all</tt>).
|
114
|
-
# +query_params+:: The (unsafe) query parameters from the URL as a
|
115
|
-
# +rules+:: The parsing rules as a
|
114
|
+
# +query_params+:: The (unsafe) query parameters from the URL as a hash.
|
115
|
+
# +rules+:: The parsing rules as a hash.
|
116
116
|
# +options+:: Additional options for <tt>find</tt>, such as <tt>:include => [ :an_association ]</tt>.
|
117
117
|
#
|
118
118
|
# === Return
|
@@ -188,7 +188,7 @@ module SearchableRecord
|
|
188
188
|
cond_syms = { }
|
189
189
|
|
190
190
|
# The hash query_params is not empty, therefore, it contains at least
|
191
|
-
# some of the allowed query parameters (as
|
191
|
+
# some of the allowed query parameters (as symbols) below. Those
|
192
192
|
# parameters that are not identified are ignored silently.
|
193
193
|
|
194
194
|
parse_since_and_until(cond_strs, cond_syms, query_params, rules)
|
data/lib/searchable_record.rb
CHANGED
data/searchable_record.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{searchable_record}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Tuomas Kareinen"]
|
9
|
-
s.date = %q{2009-01-
|
9
|
+
s.date = %q{2009-01-15}
|
10
10
|
s.description = %q{SearchableRecord is a small Ruby on Rails plugin that makes the parsing of query parameters from URLs easy for resources, allowing the requester to control the items (records) shown in the resource's representation.}
|
11
11
|
s.email = %q{tkareine@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG.rdoc", "lib/searchable_record/core.rb", "lib/searchable_record/util.rb", "lib/searchable_record/version.rb", "lib/searchable_record.rb", "README.rdoc"]
|
13
|
-
s.files = ["CHANGELOG.rdoc", "lib/searchable_record/core.rb", "lib/searchable_record/util.rb", "lib/searchable_record/version.rb", "lib/searchable_record.rb", "
|
13
|
+
s.files = ["CHANGELOG.rdoc", "lib/searchable_record/core.rb", "lib/searchable_record/util.rb", "lib/searchable_record/version.rb", "lib/searchable_record.rb", "Rakefile", "README.rdoc", "spec/core_spec.rb", "spec/searchable_record_spec_helper.rb", "spec/util_spec.rb", "Manifest", "searchable_record.gemspec"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://searchable-rec.rubyforge.org}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Searchable_record", "--main", "README.rdoc"]
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchable_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tuomas Kareinen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-15 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,12 +51,12 @@ files:
|
|
51
51
|
- lib/searchable_record/util.rb
|
52
52
|
- lib/searchable_record/version.rb
|
53
53
|
- lib/searchable_record.rb
|
54
|
-
- Manifest
|
55
54
|
- Rakefile
|
56
55
|
- README.rdoc
|
57
|
-
- spec/
|
56
|
+
- spec/core_spec.rb
|
58
57
|
- spec/searchable_record_spec_helper.rb
|
59
58
|
- spec/util_spec.rb
|
59
|
+
- Manifest
|
60
60
|
- searchable_record.gemspec
|
61
61
|
has_rdoc: true
|
62
62
|
homepage: http://searchable-rec.rubyforge.org
|