Class: ActiveAction::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/active_action/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action, options = {}) ⇒ Action

Returns a new instance of Action.



4
5
6
7
8
9
10
# File 'lib/active_action/action.rb', line 4

def initialize(action, options = {})
  options.assert_valid_keys(:scope, :label, :path, :scopes)
  @action = action
  @label = options[:label] || @action.to_s
  @scopes = options[:scopes] || Array.wrap(options[:scope] || :all)
  @path = (options[:path] || @action).to_s
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/active_action/action.rb', line 3

def action
  @action
end

#labelObject (readonly)

Returns the value of attribute label.



3
4
5
# File 'lib/active_action/action.rb', line 3

def label
  @label
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/active_action/action.rb', line 3

def path
  @path
end

#scopesObject (readonly)

Returns the value of attribute scopes.



3
4
5
# File 'lib/active_action/action.rb', line 3

def scopes
  @scopes
end