Class: Pulitzer::PostTypeVersionsController::ChangeState

Inherits:
Object
  • Object
show all
Defined in:
app/interactions/pulitzer/post_type_versions_controller/change_state.rb

Instance Method Summary collapse

Constructor Details

#initialize(ptv, state_change) ⇒ ChangeState

Returns a new instance of ChangeState.



3
4
5
# File 'app/interactions/pulitzer/post_type_versions_controller/change_state.rb', line 3

def initialize(ptv,state_change)
  @ptv, @state_change = ptv, state_change.to_sym
end

Instance Method Details

#callObject



7
8
9
10
# File 'app/interactions/pulitzer/post_type_versions_controller/change_state.rb', line 7

def call
  sanitize_state_change or return false
  @ptv.send @state_change
end

#sanitize_state_changeObject



12
13
14
# File 'app/interactions/pulitzer/post_type_versions_controller/change_state.rb', line 12

def sanitize_state_change
  return [:publish,:retire,:preview].include? @state_change
end