Class: Anoubis::Output::Autocomplete

Inherits:
Basic
  • Object
show all
Defined in:
app/controllers/anoubis/output/autocomplete.rb

Overview

Output subclass that represents data for edit(new) action

Instance Attribute Summary collapse

Attributes inherited from Basic

#messages, #result, #tab, #title

Instance Method Summary collapse

Methods inherited from Basic

#hash_to_json, #message, #options_to_json

Constructor Details

#initializeAutocomplete

Initializes menu output data. Generates default values.



12
13
14
15
# File 'app/controllers/anoubis/output/autocomplete.rb', line 12

def initialize
  super
  self.values = []
end

Instance Attribute Details

#valuesHash

Returns the hash of defined fields.

Returns:

  • (Hash)

    the hash of defined fields.



8
# File 'app/controllers/anoubis/output/autocomplete.rb', line 8

class_attribute :values, default: {}

Instance Method Details

#to_hHash

Generates hash representation of output class

Returns:

  • (Hash)

    hash representation of all data



20
21
22
23
24
25
26
27
# File 'app/controllers/anoubis/output/autocomplete.rb', line 20

def to_h
  result = super.to_h
  return result if self.result != 0
  result.merge!({
                    values: self.values,
                })
  result
end