Class: Nitro::AttributeControl

Inherits:
Control show all
Defined in:
lib/nitro/control/attribute.rb

Overview

The base class for controls used to inspect object attributes. – TODO: find a better name. ++

Instance Attribute Summary collapse

Attributes included from ElementMixin

#_children, #_parent, #_text, #_view, #id

Instance Method Summary collapse

Methods included from XhtmlHelper

#date_select, #datetime_select, #hidden, #href_of, #js_popup, #link_to, #objects_to_options, #onclick_popup, #options, #popup, #submit, #time_select

Methods inherited from Element

compile_template_elements

Methods included from ElementMixin

#add_child, #close, #content, #open, #render, #render_children

Constructor Details

#initialize(object, a, options) ⇒ AttributeControl

Input

  • object = the object to inspect

  • a = the attribute to inspect

  • options = additional options



32
33
34
35
36
37
38
39
# File 'lib/nitro/control/attribute.rb', line 32

def initialize(object, a, options)
  @object = object
  @attribute = a
  @anno = @object.class.ann(@attribute)
  @objann = @object.annotation[@attribute] || @object.annotation
  @value = @object.send(@attribute)
  @options = options
end

Instance Attribute Details

#annoObject

The annotations used for rendering



19
20
21
# File 'lib/nitro/control/attribute.rb', line 19

def anno
  @anno
end

#attributeObject

The attribute that this control renders.



15
16
17
# File 'lib/nitro/control/attribute.rb', line 15

def attribute
  @attribute
end

#valueObject Also known as: values

The value



23
24
25
# File 'lib/nitro/control/attribute.rb', line 23

def value
  @value
end