Class: Iord::JsonOutput

Inherits:
OutputHelper show all
Defined in:
lib/iord/json_output.rb

Instance Attribute Summary

Attributes inherited from OutputHelper

#v

Instance Method Summary collapse

Methods inherited from OutputHelper

#fieldset, #initialize, #input, #iterate_form, #link_to_add, #link_to_collection, #link_to_create, #link_to_destroy, #link_to_edit, #link_to_iterate, #link_to_iterate_edit, #link_to_iterate_if_enabled, #link_to_iterate_next_if_possible, #link_to_iterate_previous_if_possible, #link_to_iterate_show, #link_to_remove, #link_to_show, #order_by, #page, #paginate_if_enabled, #pagination, #search_form, #search_if_enabled, #search_operator, #search_submit, #search_term, #search_value, #sort_asc_symbol, #sort_desc_symbol, #sort_if_enabled, #submit, #submit_to_next_if_possible, #submit_to_previous_if_possible

Constructor Details

This class inherits a constructor from Iord::OutputHelper

Instance Method Details

#display(object, attrs) ⇒ Object



5
6
7
# File 'lib/iord/json_output.rb', line 5

def display(object, attrs)
  Hash[attrs.collect {|attr| [v.field_name(attr), v.field_value(object, attr)]}]
end

#display_array(array, attrs) ⇒ Object



9
10
11
# File 'lib/iord/json_output.rb', line 9

def display_array(array, attrs)
  array.collect {|element| display(element, attrs) }
end

#image(url, hsh) ⇒ Object



17
18
19
# File 'lib/iord/json_output.rb', line 17

def image(url, hsh)
  {image: url}
end


13
14
15
# File 'lib/iord/json_output.rb', line 13

def link_to(label, url, hsh)
  {url: url, label: label}
end