Class: Interview::MediaObject
- Includes:
- HasControls
- Defined in:
- lib/interview/media_object.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Attributes included from HasControls
Attributes inherited from Control
Instance Method Summary collapse
Methods included from HasControls
#add_control, #add_controls, included, #initialize, #siblings
Methods inherited from Control
#ancestors, build, definition, #find_attribute, #find_attribute!, inherited, #initialize, #set_attributes, #set_defaults
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/interview/media_object.rb', line 5 def object @object end |
Instance Method Details
#render ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/interview/media_object.rb', line 7 def render image_size = @image_size || :thumb object = find_attribute :object @object = object html = Builder::XmlMarkup.new(indent: 2) html.div class: 'media' do @controls[0].html_class << 'pull-left' if @controls[0].respond_to? 'html_class' html << @controls.first.render html.div class: 'media-body' do @controls[1].html_class << 'media-heading' if @controls[1].respond_to? 'html_class' @controls[1..-1].each do |control| html << control.render end end end return html.target! end |