Class: Katalyst::Tables::Collection::Query::ValueParser
- Inherits:
-
Object
- Object
- Katalyst::Tables::Collection::Query::ValueParser
show all
- Defined in:
- app/models/concerns/katalyst/tables/collection/query/value_parser.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(key:, start:) ⇒ ValueParser
Returns a new instance of ValueParser.
10
11
12
13
|
# File 'app/models/concerns/katalyst/tables/collection/query/value_parser.rb', line 10
def initialize(key:, start:)
@key = key
@start = start
end
|
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
8
9
10
|
# File 'app/models/concerns/katalyst/tables/collection/query/value_parser.rb', line 8
def key
@key
end
|
#query ⇒ Object
Returns the value of attribute query.
8
9
10
|
# File 'app/models/concerns/katalyst/tables/collection/query/value_parser.rb', line 8
def query
@query
end
|
Instance Method Details
#literal? ⇒ Boolean
15
16
17
|
# File 'app/models/concerns/katalyst/tables/collection/query/value_parser.rb', line 15
def literal?
false
end
|
#range ⇒ Object
23
24
25
|
# File 'app/models/concerns/katalyst/tables/collection/query/value_parser.rb', line 23
def range
@start..@end
end
|
#skip_whitespace ⇒ Object
41
42
43
|
# File 'app/models/concerns/katalyst/tables/collection/query/value_parser.rb', line 41
def skip_whitespace
query.scan(/\s+/)
end
|
#tagged? ⇒ Boolean
19
20
21
|
# File 'app/models/concerns/katalyst/tables/collection/query/value_parser.rb', line 19
def tagged?
true
end
|
#take_quoted_value ⇒ Object
27
28
29
30
31
|
# File 'app/models/concerns/katalyst/tables/collection/query/value_parser.rb', line 27
def take_quoted_value
return unless query.scan(/"([^"]*)"/)
self.value, = query.values_at(1)
end
|
#take_unquoted_value ⇒ Object
33
34
35
36
37
38
39
|
# File 'app/models/concerns/katalyst/tables/collection/query/value_parser.rb', line 33
def take_unquoted_value
return unless query.scan(/"?([^ \],]*)/)
self.value, = query.values_at(1)
end
|