Class: MarkLogic::DatabaseSettings::RangeElementIndex
- Inherits:
-
Object
- Object
- MarkLogic::DatabaseSettings::RangeElementIndex
- Defined in:
- lib/marklogic/database_settings/range_element_index.rb
Instance Attribute Summary collapse
-
#collation ⇒ Object
Returns the value of attribute collation.
-
#facet ⇒ Object
Returns the value of attribute facet.
-
#invalid_values ⇒ Object
Returns the value of attribute invalid_values.
-
#localname ⇒ Object
Returns the value of attribute localname.
-
#namespace_uri ⇒ Object
Returns the value of attribute namespace_uri.
-
#range_value_positions ⇒ Object
Returns the value of attribute range_value_positions.
-
#scalar_type ⇒ Object
Returns the value of attribute scalar_type.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #append_to_db(database) ⇒ Object
- #from_json(json) ⇒ Object
-
#initialize(name, options = {}) ⇒ RangeElementIndex
constructor
A new instance of RangeElementIndex.
- #key ⇒ Object
- #to_json(options = nil) ⇒ Object
- #to_ref ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ RangeElementIndex
Returns a new instance of RangeElementIndex.
7 8 9 10 11 12 13 14 15 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 7 def initialize(name, = {}) @scalar_type = [:type] || 'string' @localname = name.to_s @namespace_uri = [:namespace] || "" @collation = [:collation] || (@scalar_type == 'string' ? MarkLogic::DEFAULT_COLLATION : "") @range_value_positions = [:range_value_positions] || false @invalid_values = [:invalid_values] || MarkLogic::REJECT @facet = [:facet] || false end |
Instance Attribute Details
#collation ⇒ Object
Returns the value of attribute collation.
5 6 7 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 5 def collation @collation end |
#facet ⇒ Object
Returns the value of attribute facet.
5 6 7 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 5 def facet @facet end |
#invalid_values ⇒ Object
Returns the value of attribute invalid_values.
5 6 7 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 5 def invalid_values @invalid_values end |
#localname ⇒ Object
Returns the value of attribute localname.
5 6 7 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 5 def localname @localname end |
#namespace_uri ⇒ Object
Returns the value of attribute namespace_uri.
5 6 7 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 5 def namespace_uri @namespace_uri end |
#range_value_positions ⇒ Object
Returns the value of attribute range_value_positions.
5 6 7 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 5 def range_value_positions @range_value_positions end |
#scalar_type ⇒ Object
Returns the value of attribute scalar_type.
5 6 7 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 5 def scalar_type @scalar_type end |
Class Method Details
.from_json(json) ⇒ Object
60 61 62 63 64 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 60 def self.from_json(json) index = allocate index.from_json(json) index end |
Instance Method Details
#<=>(other) ⇒ Object
21 22 23 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 21 def <=>(other) localname <=> other.localname end |
#==(other) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 25 def ==(other) self.class == other.class and scalar_type == other.scalar_type and localname = other.localname and namespace_uri = other.namespace_uri and collation == other.collation and range_value_positions == other.range_value_positions and invalid_values == other.invalid_values end |
#append_to_db(database) ⇒ Object
39 40 41 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 39 def append_to_db(database) database.add_index("range-element-index", self) end |
#from_json(json) ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 66 def from_json(json) @scalar_type = json['scalar-type'] @namespace_uri = json['namespace-uri'] @localname = json['localname'] @collation = json['collation'] @range_value_positions = json['range-value-positions'] @invalid_values = json['invalid-values'] @facet = false end |
#key ⇒ Object
17 18 19 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 17 def key %Q{#{self.class.to_s}-#{@localname}} end |
#to_json(options = nil) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 43 def to_json( = nil) { "scalar-type" => @scalar_type, "namespace-uri" => @namespace_uri, "localname" => @localname, "collation" => @collation, "range-value-positions" => @range_value_positions, "invalid-values" => @invalid_values } end |
#to_ref ⇒ Object
54 55 56 57 58 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 54 def to_ref = [%Q{"type=#{@scalar_type}"}] << %Q{"collation=#{@collation}"} if @scalar_type == "string" %Q{cts:json-property-reference("#{@localname}", (#{options.join(',')}))} end |
#type ⇒ Object
35 36 37 |
# File 'lib/marklogic/database_settings/range_element_index.rb', line 35 def type "range-element-index" end |