Class: RapidTransit::Action::InstanceMethod

Inherits:
Base
  • Object
show all
Defined in:
lib/rapid_transit/action/instance_method.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#action_name, #block, #condition, #key, #options

Instance Method Summary collapse

Methods inherited from Base

#apply?, #result, #valid?

Constructor Details

#initialize(action_name, *args) ⇒ InstanceMethod

Returns a new instance of InstanceMethod.



5
6
7
8
9
# File 'lib/rapid_transit/action/instance_method.rb', line 5

def initialize(action_name, *args)
  super
  @attributes = @options
  @validations += [:attributes]
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#requires_attributes?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rapid_transit/action/instance_method.rb', line 15

def requires_attributes?
  ![:save, :destroy].include? action_name
end

#requires_no_attributes?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/rapid_transit/action/instance_method.rb', line 19

def requires_no_attributes?
  [:save, :destroy].include? action_name
end

#result_saved?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/rapid_transit/action/instance_method.rb', line 11

def result_saved?
  ![:destroy].include? action_name
end