Class: Olelo::Attributes::Attribute::Suggestions Private

Inherits:
Enum show all
Defined in:
lib/olelo/attributes.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Olelo::Attributes::Attribute

#key, #name

Instance Method Summary collapse

Methods inherited from Enum

#initialize

Methods inherited from Olelo::Attributes::Attribute

#build_form, #initialize, #label, #label_tag

Methods included from Util

#check, #decode64, #deep_copy, #encode64, #escape, #escape_html, #escape_javascript, included, #md5, #no_cache?, #sha256, #titlecase, #truncate, #unescape, #unescape_backslash, #unescape_html, #valid_xml_chars?

Constructor Details

This class inherits a constructor from Olelo::Attributes::Attribute::Enum

Instance Method Details

#field_tag(attr) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



119
120
121
122
123
124
# File 'lib/olelo/attributes.rb', line 119

def field_tag(attr)
  %{<input class="observe" type="text" id="#{key}" name="#{key}" value="#{escape_html(values[attr] || attr)}"/>
    <script type="text/javascript">
    $('##{key}').combobox({ source: #{escape_javascript MultiJson.dump(values.values.sort)} });
    </script>}
end

#inverted_valuesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



131
132
133
# File 'lib/olelo/attributes.rb', line 131

def inverted_values
  @inverted_values ||= values.invert
end

#parse(params) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



126
127
128
129
# File 'lib/olelo/attributes.rb', line 126

def parse(params)
  value = params[key]
  inverted_values[value] || value if !value.blank?
end