Sha256: d53199603522ca32cf207c5722c086c55e0ea98a2c0eac12cf392b717a87650e

Contents?: true

Size: 446 Bytes

Versions: 6

Compression:

Stored size: 446 Bytes

Contents

require 'iord/output_helper'

module Iord
  class JsonOutput < ::Iord::OutputHelper
    def display(object, attrs)
      Hash[attrs.collect {|attr| [v.field_name(attr), v.field_value(object, attr)]}]
    end

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
iord-1.2.2 lib/iord/json_output.rb
iord-1.2.1 lib/iord/json_output.rb
iord-1.2.0 lib/iord/json_output.rb
iord-1.1.3 lib/iord/json_output.rb
iord-1.1.2 lib/iord/json_output.rb
iord-1.1.1 lib/iord/json_output.rb