Class: Couchbase::Cluster::SearchFacet::SearchFacetDateRange
- Inherits:
-
Object
- Object
- Couchbase::Cluster::SearchFacet::SearchFacetDateRange
- Defined in:
- lib/couchbase/search_options.rb
Constant Summary collapse
- DATE_FORMAT_RFC3339 =
"%Y-%m-%dT%H:%M:%S%:z"
Instance Attribute Summary collapse
- #field ⇒ String readonly
- #size ⇒ Integer
Instance Method Summary collapse
- #add(name, start_time, end_time) ⇒ Object
-
#initialize(field) {|_self| ... } ⇒ SearchFacetDateRange
constructor
A new instance of SearchFacetDateRange.
Constructor Details
#initialize(field) {|_self| ... } ⇒ SearchFacetDateRange
Returns a new instance of SearchFacetDateRange.
1121 1122 1123 1124 1125 |
# File 'lib/couchbase/search_options.rb', line 1121 def initialize(field) @field = field @ranges = [] yield self if block_given? end |
Instance Attribute Details
#field ⇒ String (readonly)
1115 1116 1117 |
# File 'lib/couchbase/search_options.rb', line 1115 def field @field end |
#size ⇒ Integer
1118 1119 1120 |
# File 'lib/couchbase/search_options.rb', line 1118 def size @size end |
Instance Method Details
#add(name, start_time, end_time) ⇒ Object
1132 1133 1134 1135 1136 |
# File 'lib/couchbase/search_options.rb', line 1132 def add(name, start_time, end_time) start_time = start_time.strftime(DATE_FORMAT_RFC3339) if start_time && start_time.respond_to?(:strftime) end_time = end_time.strftime(DATE_FORMAT_RFC3339) if end_time && end_time.respond_to?(:strftime) @ranges.append({name: name, start: start_time, end: end_time}) end |