Module: Lotus::Action::Exposable

Defined in:
lib/lotus/action/exposable.rb

Overview

Exposures API

See Also:

Since:

  • 0.1.0

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Override Ruby’s hook for modules. It includes exposures logic

Parameters:

  • base (Class)

    the target action

See Also:

Since:

  • 0.1.0



18
19
20
# File 'lib/lotus/action/exposable.rb', line 18

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#exposuresHash

Set of exposures

Returns:

  • (Hash)

    the exposures

See Also:

  • Lotus::Action::Exposable::ClassMethods.expose

Since:

  • 0.1.0



95
96
97
98
99
100
101
# File 'lib/lotus/action/exposable.rb', line 95

def exposures
  @exposures ||= {}.tap do |result|
    self.class.exposures.each do |name|
      result[name] = send(name)
    end
  end
end

#finishObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Finalize the response

See Also:

  • Lotus::Action#finish

Since:

  • 0.3.0



109
110
111
112
# File 'lib/lotus/action/exposable.rb', line 109

def finish
  super
  exposures
end