Class: UserSettingsPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/user_settings_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ UserSettingsPresenter

Returns a new instance of UserSettingsPresenter.



4
5
6
# File 'app/presenters/user_settings_presenter.rb', line 4

def initialize(resource)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



2
3
4
# File 'app/presenters/user_settings_presenter.rb', line 2

def resource
  @resource
end

Instance Method Details

#as_jsonObject



8
9
10
11
12
13
14
15
16
17
# File 'app/presenters/user_settings_presenter.rb', line 8

def as_json
  if @resource == false || @resource == true || @resource == nil
    { success:  @resource || false }
  else
    {
      success: true,
      value: @resource
    }
  end
end