Welcome to mirror list, hosted at ThFree Co, Russian Federation.

aspect_presenter.rb « presenters « app - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 48679fe8dd39093f5afd674621ec396d1ac90244 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

class AspectPresenter < BasePresenter
  def initialize(aspect)
    @aspect = aspect
  end

  def as_json
    { :id => @aspect.id,
      :name => @aspect.name,
    }
  end

  def as_api_json(full=false, with_order: true)
    values = {
      id:   @aspect.id,
      name: @aspect.name
    }
    values[:order] = @aspect.order_id if with_order
    values
  end

  def to_json(options={})
    as_json.to_json(options)
  end
end