Class: Olelo::Attributes::Attribute::Boolean Private

Inherits:
Olelo::Attributes::Attribute 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 Olelo::Attributes::Attribute

#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

Instance Method Details

#build_form(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.



73
74
75
# File 'lib/olelo/attributes.rb', line 73

def build_form(attr)
  "<div class=\"indent\">#{field_tag(attr)}#{label_tag}</div><br/>\n"
end

#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.



69
70
71
# File 'lib/olelo/attributes.rb', line 69

def field_tag(attr)
  %{<input class="observe" type="checkbox" id="#{key}" name="#{key}" value="true"#{attr ? ' checked="checked"' : ''}/>}
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.



77
78
79
80
# File 'lib/olelo/attributes.rb', line 77

def parse(params)
  value = params[key]
  true if value == 'true'
end