Class: RubyApp::Element

Inherits:
Object
  • Object
show all
Extended by:
Haml::Helpers, Mixins::ConfigurationMixin, Mixins::RenderMixin, Mixins::TemplateMixin, Mixins::TranslateMixin
Includes:
Haml::Helpers, Mixins::ConfigurationMixin, Mixins::RenderMixin, Mixins::TranslateMixin
Defined in:
lib/ruby_app/element.rb

Defined Under Namespace

Classes: Event, ExceptionEvent

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::ConfigurationMixin

configuration

Methods included from Mixins::TranslateMixin

localize, translate

Methods included from Mixins::TemplateMixin

exclude_parent_template, exclude_parent_template?, get_template, get_templates, template_name, template_path

Methods included from Mixins::RenderMixin

content_for, render, rendered?, templates

Constructor Details

#initializeElement

Returns a new instance of Element.



137
138
139
# File 'lib/ruby_app/element.rb', line 137

def initialize
  @attributes = {:id => self.element_id}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



133
134
135
# File 'lib/ruby_app/element.rb', line 133

def attributes
  @attributes
end

Class Method Details

.get_content_type(format) ⇒ Object



145
146
147
# File 'lib/ruby_app/element.rb', line 145

def self.get_content_type(format)
  ( mime_type = MIME::Types.type_for(format)[0] ) ? mime_type.content_type : 'text/plain'
end

.get_element(element_id) ⇒ Object



149
150
151
152
# File 'lib/ruby_app/element.rb', line 149

def self.get_element(element_id)
  element_id =~ /(-?\d+)/
  ObjectSpace._id2ref($1.to_i)
end

Instance Method Details

#element_idObject



141
142
143
# File 'lib/ruby_app/element.rb', line 141

def element_id
  "id_#{object_id}"
end