Class: Velocity::Instance::Dictionary
- Defined in:
- lib/acceleration/velocity.rb
Overview
Interact with a dictionary on the Velocity instance
Note that dictionary-list-xml
is implemented as Velocity::Instance#dictionaries.
Defined Under Namespace
Classes: AutocompleteSuggestion, AutocompleteSuggestionSet
Instance Attribute Summary collapse
-
#name ⇒ Object
The name of the dictionary.
Attributes inherited from APIModel
Class Method Summary collapse
-
.new_from_xml(args) ⇒ Object
call-seq: Dictionary.new_from_xml(:xml => xml, :instance => instance).
Instance Method Summary collapse
-
#autocomplete_suggest(args = {}) ⇒ Object
call-seq: autocomplete_suggest(:str => “”).
-
#build ⇒ Object
Begin a build of the dictionary.
-
#create(_args = {}) ⇒ Object
Create the dictionary.
-
#delete ⇒ Object
Delete the dictionary.
-
#initialize(name) ⇒ Dictionary
constructor
Create a new wrapper for a dictionary.
-
#status ⇒ Object
Get the dictionary’s status object.
-
#stop(_args = {}) ⇒ Object
Stop the dictionary build process.
Methods inherited from APIModel
#method_missing, #resolve, #respond_to_missing?
Constructor Details
#initialize(name) ⇒ Dictionary
Create a new wrapper for a dictionary
1098 1099 1100 |
# File 'lib/acceleration/velocity.rb', line 1098 def initialize(name) @name = name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Velocity::Instance::APIModel
Instance Attribute Details
#name ⇒ Object
The name of the dictionary.
1076 1077 1078 |
# File 'lib/acceleration/velocity.rb', line 1076 def name @name end |
Class Method Details
.new_from_xml(args) ⇒ Object
call-seq:
Dictionary.new_from_xml(:xml => xml, :instance => instance)
Factory method used by Instance#dictionaries
1089 1090 1091 1092 1093 |
# File 'lib/acceleration/velocity.rb', line 1089 def self.new_from_xml(args) d = Dictionary.new(args[:xml].attributes['name'].to_s) d.instance = args[:instance] d end |
Instance Method Details
#autocomplete_suggest(args = {}) ⇒ Object
call-seq:
autocomplete_suggest(:str => "")
Provide an autocompletion
You must provide a :str
option in order to receive results.
1152 1153 1154 1155 1156 |
# File 'lib/acceleration/velocity.rb', line 1152 def autocomplete_suggest(args = {}) api_method = __method__.dasherize asargs = args.merge(dictionary: name) AutocompleteSuggestionSet.new_from_xml instance.call(api_method, asargs) end |
#build ⇒ Object
Begin a build of the dictionary
1114 1115 1116 |
# File 'lib/acceleration/velocity.rb', line 1114 def build act __method__ end |
#create(_args = {}) ⇒ Object
Create the dictionary
Can optionally pass :based_on
String to use another dictionary as a template
1124 1125 1126 |
# File 'lib/acceleration/velocity.rb', line 1124 def create(_args = {}) act __method__ end |
#delete ⇒ Object
Delete the dictionary
1140 1141 1142 |
# File 'lib/acceleration/velocity.rb', line 1140 def delete act __method__ end |
#status ⇒ Object
Get the dictionary’s status object
TODO: wrap the XML returned
1107 1108 1109 |
# File 'lib/acceleration/velocity.rb', line 1107 def status act 'status-xml' end |
#stop(_args = {}) ⇒ Object
Stop the dictionary build process
Can optionally pass :kill
boolean if it should be killed immediately
1133 1134 1135 |
# File 'lib/acceleration/velocity.rb', line 1133 def stop(_args = {}) act __method__, {} end |