mysearch 2.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.
- checksums.yaml +7 -0
- data/lib/mysearch.rb +24 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7a36604f00c3a834ba12850dcd1d8fbacdc2fbee5b5eaf8c03de5009d95103ed
|
4
|
+
data.tar.gz: 626f088861130d9f308c9f3a602d7500824508302729ee6f91ea74eb6bf562c8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b6761ebf2f02e01a24f3a761b1a7a395a7458ac7ae649423dfc7fdd3588a5fdbab60d3294945ede5db90a21ad92bb661c45e77eb13b8f366677a65767bb21752
|
7
|
+
data.tar.gz: 85a22d5494eeb7be79ae20a0659ad084331405ef7527b8e574a50d1064ad1d67504eaaa9154acc7f569f46cb0157462de4993e6c1f23cb34e4fe72a786c9251a
|
data/lib/mysearch.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
class MySearch
|
2
|
+
|
3
|
+
def self.booking(attributes, keyword)
|
4
|
+
query_attrs = attributes.map { |a| "#{a.to_s}::TEXT ILIKE '%#{keyword}%'"}.join(' OR ')
|
5
|
+
Booking.where(query_attrs)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.user(attributes, keyword)
|
9
|
+
query_attrs = attributes.map { |a| "#{a.to_s}::TEXT ILIKE '%#{keyword}%'"}.join(' OR ')
|
10
|
+
puts query_attrs
|
11
|
+
User.where(query_attrs)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.flight(attributes, keyword)
|
15
|
+
query_attrs = attributes.map { |a| "#{a.to_s}::TEXT ILIKE '%#{keyword}%'"}.join(' OR ')
|
16
|
+
Flight.where(query_attrs)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.hotel(attributes, keyword)
|
20
|
+
query_attrs = attributes.map { |a| "#{a.to_s}::TEXT ILIKE '%#{keyword}%'"}.join(' OR ')
|
21
|
+
Hotel.where(query_attrs)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mysearch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '2.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gabriel Salas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: x19104162@student.ncirl.ie
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/mysearch.rb
|
20
|
+
homepage:
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubygems_version: 3.3.11
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: Search for different values on application
|
43
|
+
test_files: []
|