Class: Dependabot::PullRequestCreator::CommitMessageOptions

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/pull_request_creator/commit_message_options.rb

Overview

Typed view over the commit_message_options hash threaded into the PR creator's title and prefix builders. The raw options arrive as a loosely typed hash sourced from user config, so this parses the known keys once at the boundary and lets downstream builders use typed readers instead of digging an untyped hash.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix: nil, prefix_development: nil, include_scope: false) ⇒ CommitMessageOptions

Returns a new instance of CommitMessageOptions.



32
33
34
35
36
# File 'lib/dependabot/pull_request_creator/commit_message_options.rb', line 32

def initialize(prefix: nil, prefix_development: nil, include_scope: false)
  @prefix = prefix
  @prefix_development = prefix_development
  @include_scope = include_scope
end

Instance Attribute Details

#include_scopeObject (readonly)

Returns the value of attribute include_scope.



23
24
25
# File 'lib/dependabot/pull_request_creator/commit_message_options.rb', line 23

def include_scope
  @include_scope
end

#prefixObject (readonly)

Returns the value of attribute prefix.



17
18
19
# File 'lib/dependabot/pull_request_creator/commit_message_options.rb', line 17

def prefix
  @prefix
end

#prefix_developmentObject (readonly)

Returns the value of attribute prefix_development.



20
21
22
# File 'lib/dependabot/pull_request_creator/commit_message_options.rb', line 20

def prefix_development
  @prefix_development
end

Class Method Details

.from_hash(options) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/dependabot/pull_request_creator/commit_message_options.rb', line 41

def self.from_hash(options)
  new(
    prefix: coerce_string(options[:prefix]),
    prefix_development: coerce_string(options[:prefix_development]),
    include_scope: options[:include_scope] ? true : false
  )
end

Instance Method Details

#prefix?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/dependabot/pull_request_creator/commit_message_options.rb', line 59

def prefix?
  !prefix.nil?
end

#prefix_development?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/dependabot/pull_request_creator/commit_message_options.rb', line 65

def prefix_development?
  !prefix_development.nil?
end