class InferredCrumpets::ActionProcessor
Constants
- EDIT_ACTIONS
- EDIT_LABEL
- IGNORED_ACTIONS
- NEW_ACTIONS
- NEW_LABEL
Public Class Methods
for_action(action)
click to toggle source
# File lib/inferred_crumpets/action_processor.rb, line 20 def self.for_action(action) new(action).call end
new(action)
click to toggle source
# File lib/inferred_crumpets/action_processor.rb, line 24 def initialize(action) @action = action end
Public Instance Methods
call()
click to toggle source
# File lib/inferred_crumpets/action_processor.rb, line 28 def call return build_opts(nil) if IGNORED_ACTIONS.include?(@action) return build_opts(NEW_LABEL, false) if NEW_ACTIONS.include?(@action) return build_opts(EDIT_LABEL) if EDIT_ACTIONS.include?(@action) build_opts(@action.humanize) end
Private Instance Methods
build_opts(label, has_subject = true)
click to toggle source
# File lib/inferred_crumpets/action_processor.rb, line 38 def build_opts(label, has_subject = true) OpenStruct.new(label: label, has_subject?: has_subject) end