Class: Cloudsearchable::DSL
- Inherits:
-
Object
- Object
- Cloudsearchable::DSL
- Defined in:
- lib/cloudsearchable.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
Instance Method Summary collapse
- #field(name, type, options = {}, &block) ⇒ Object
-
#initialize(domain, base) ⇒ DSL
constructor
A new instance of DSL.
- #literal(name, options = {}, &block) ⇒ Object
- #text(name, options = {}, &block) ⇒ Object
- #uint(name, options = {}, &block) ⇒ Object
Constructor Details
#initialize(domain, base) ⇒ DSL
Returns a new instance of DSL.
63 64 65 66 |
# File 'lib/cloudsearchable.rb', line 63 def initialize domain, base @domain = domain @base = base end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
61 62 63 |
# File 'lib/cloudsearchable.rb', line 61 def base @base end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
61 62 63 |
# File 'lib/cloudsearchable.rb', line 61 def domain @domain end |
Instance Method Details
#field(name, type, options = {}, &block) ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/cloudsearchable.rb', line 80 def field name, type, = {}, &block # This block is executed in the context of the record if block_given? [:source] = block.to_proc end domain.add_field name, type, end |
#literal(name, options = {}, &block) ⇒ Object
76 77 78 |
# File 'lib/cloudsearchable.rb', line 76 def literal name, = {}, &block field name, :literal, , &block end |
#text(name, options = {}, &block) ⇒ Object
72 73 74 |
# File 'lib/cloudsearchable.rb', line 72 def text name, = {}, &block field name, :text, , &block end |
#uint(name, options = {}, &block) ⇒ Object
68 69 70 |
# File 'lib/cloudsearchable.rb', line 68 def uint name, = {}, &block field name, :uint, , &block end |