Class: SnippetInputAction
- Inherits:
-
Object
- Object
- SnippetInputAction
- Includes:
- ActiveModel::Validations
- Defined in:
- app/models/snippet_input_action.rb
Constant Summary collapse
- ACTIONS =
%i[create update delete move].freeze
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#previous_path ⇒ Object
readonly
Returns the value of attribute previous_path.
Instance Method Summary collapse
-
#initialize(action: nil, previous_path: nil, file_path: nil, content: nil, allowed_actions: nil) ⇒ SnippetInputAction
constructor
A new instance of SnippetInputAction.
- #to_commit_action ⇒ Object
Constructor Details
#initialize(action: nil, previous_path: nil, file_path: nil, content: nil, allowed_actions: nil) ⇒ SnippetInputAction
Returns a new instance of SnippetInputAction.
24 25 26 27 28 29 30 |
# File 'app/models/snippet_input_action.rb', line 24 def initialize(action: nil, previous_path: nil, file_path: nil, content: nil, allowed_actions: nil) @action = action&.to_sym @previous_path = previous_path @file_path = file_path @content = content @allowed_actions = Array(allowed_actions).map(&:to_sym) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
14 15 16 |
# File 'app/models/snippet_input_action.rb', line 14 def action @action end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
14 15 16 |
# File 'app/models/snippet_input_action.rb', line 14 def content @content end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
14 15 16 |
# File 'app/models/snippet_input_action.rb', line 14 def file_path @file_path end |
#previous_path ⇒ Object (readonly)
Returns the value of attribute previous_path.
14 15 16 |
# File 'app/models/snippet_input_action.rb', line 14 def previous_path @previous_path end |
Instance Method Details
#to_commit_action ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/models/snippet_input_action.rb', line 32 def to_commit_action { action: action, previous_path: build_previous_path, file_path: file_path, content: content } end |