Class: Qiita::Elasticsearch::DateToken::BaseDateExpression
- Inherits:
-
Object
- Object
- Qiita::Elasticsearch::DateToken::BaseDateExpression
- Defined in:
- lib/qiita/elasticsearch/date_token.rb
Direct Known Subclasses
Constant Summary collapse
- FIELD_NAMES_TABLE =
{ "created" => "created_at", "updated" => "updated_at", }
Instance Method Summary collapse
-
#converted_field_name ⇒ String
e.g.
-
#initialize(token) ⇒ BaseDateExpression
constructor
A new instance of BaseDateExpression.
- #match ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(token) ⇒ BaseDateExpression
Returns a new instance of BaseDateExpression.
20 21 22 |
# File 'lib/qiita/elasticsearch/date_token.rb', line 20 def initialize(token) @token = token end |
Instance Method Details
#converted_field_name ⇒ String
e.g. created:2000-01-01 -> created_at
34 35 36 |
# File 'lib/qiita/elasticsearch/date_token.rb', line 34 def converted_field_name FIELD_NAMES_TABLE[@token.field_name] || @token.field_name end |
#match ⇒ Object
24 25 26 |
# File 'lib/qiita/elasticsearch/date_token.rb', line 24 def match @match ||= self.class::PATTERN.match(@token.range_query || @token.term) end |
#to_hash ⇒ Object
28 29 30 |
# File 'lib/qiita/elasticsearch/date_token.rb', line 28 def to_hash fail NotImplementedError end |