Module: Elasticsearch::DSL::Search::BaseComponent::ClassMethods
- Defined in:
- lib/elasticsearch/dsl/search/base_component.rb
Instance Method Summary collapse
-
#name(value = nil) ⇒ Object
Get or set the name for the DSL class.
-
#name=(value) ⇒ Object
Set the name for the DSL class.
- #option_methods ⇒ Object
Instance Method Details
#name(value = nil) ⇒ Object
Get or set the name for the DSL class
103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/elasticsearch/dsl/search/base_component.rb', line 103 def name(value=nil) if value @name = value.to_sym else @name ||= begin value = self.to_s.split('::').last value.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2') value.gsub!(/([a-z\d])([A-Z])/,'\1_\2') value.tr!("-", "_") value.downcase! value.to_sym end end end |
#name=(value) ⇒ Object
Set the name for the DSL class
120 121 122 |
# File 'lib/elasticsearch/dsl/search/base_component.rb', line 120 def name=(value) @name = value.to_sym end |
#option_methods ⇒ Object
124 125 126 |
# File 'lib/elasticsearch/dsl/search/base_component.rb', line 124 def option_methods @option_methods ||= [] end |