Class: SimpleSolrClient::Schema::CopyField
- Inherits:
-
Object
- Object
- SimpleSolrClient::Schema::CopyField
- Includes:
- Matcher
- Defined in:
- lib/simple_solr_client/schema/copyfield.rb
Instance Attribute Summary collapse
-
#dest ⇒ Object
Returns the value of attribute dest.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
-
#dynamic_name(s) ⇒ Object
What name will we get from a matching thing?.
-
#initialize(source, dest) ⇒ CopyField
constructor
A new instance of CopyField.
- #to_xml_node(doc = nil) ⇒ Object
Methods included from Matcher
Constructor Details
#initialize(source, dest) ⇒ CopyField
Returns a new instance of CopyField.
8 9 10 11 12 13 |
# File 'lib/simple_solr_client/schema/copyfield.rb', line 8 def initialize(source, dest) self.source = source @dest = dest @matcher = derive_matcher(source) @dest_matcher = derive_matcher(dest) end |
Instance Attribute Details
#dest ⇒ Object
Returns the value of attribute dest.
6 7 8 |
# File 'lib/simple_solr_client/schema/copyfield.rb', line 6 def dest @dest end |
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/simple_solr_client/schema/copyfield.rb', line 6 def source @source end |
Instance Method Details
#dynamic_name(s) ⇒ Object
What name will we get from a matching thing?
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/simple_solr_client/schema/copyfield.rb', line 16 def dynamic_name(s) return @dest unless @dest =~ /\*/ m = @matcher.match(s) if m prefix = m[1] return @dest.sub(/\*/, prefix) end nil end |
#to_xml_node(doc = nil) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/simple_solr_client/schema/copyfield.rb', line 33 def to_xml_node(doc = nil) doc ||= Nokogiri::XML::Document.new cf = Nokogiri::XML::Element.new('copyField', doc) cf['source'] = source cf['dest'] = dest cf end |