Module: Cathode::ActionDsl

Included in:
Action, Resource, Version
Defined in:
lib/cathode/action_dsl.rb

Overview

Holds the domain-specific language (DSL) for describing actions.

Instance Method Summary collapse

Instance Method Details

#actionsArray

Lists all the actions; initializes an empty ‘ObjectCollection` if there aren’t any yet

Returns:

  • (Array)

    The actions



20
21
22
# File 'lib/cathode/action_dsl.rb', line 20

def actions
  @actions ||= ObjectCollection.new
end

#custom_actionsArray

Lists the actions that are not default

Returns:

  • (Array)

    The custom actions



13
14
15
# File 'lib/cathode/action_dsl.rb', line 13

def custom_actions
  actions - default_actions
end

#default_actionsArray

Lists the actions that are default (i.e., ‘index`, `show`, `create`,

`update`, and `destroy`)

Returns:

  • (Array)

    The default actions



7
8
9
# File 'lib/cathode/action_dsl.rb', line 7

def default_actions
  actions.select { |action| DEFAULT_ACTIONS.include? action.name }
end