Class: Omgcnb::BitOfBuildpack

Inherits:
Object
  • Object
show all
Defined in:
lib/omgcnb/bit_of_buildpack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(toml_contents:, changelog_contents:) ⇒ BitOfBuildpack

Returns a new instance of BitOfBuildpack.



6
7
8
9
10
11
# File 'lib/omgcnb/bit_of_buildpack.rb', line 6

def initialize(toml_contents: , changelog_contents: )
  @toml = Tomlrb.parse(toml_contents, symbolize_keys: true)
  @name = toml.fetch(:buildpack).fetch(:id)

  @unreleased_markdown = UnreleasedMarkdown.new(changelog_contents)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/omgcnb/bit_of_buildpack.rb', line 5

def name
  @name
end

Instance Method Details

#changed_listObject



17
18
19
# File 'lib/omgcnb/bit_of_buildpack.rb', line 17

def changed_list
  @unreleased_markdown.changed_list
end

#depends_on(show_optional: false) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/omgcnb/bit_of_buildpack.rb', line 25

def depends_on(show_optional: false)
  @depends_on = toml&.[](:order)
      &.map { |group_array| group_array[:group] }
      &.flatten
      &.map {|group|
        if show_optional || !group[:optional]
          group[:id]
        else
          nil
        end
      }&.compact || []
end

#needs_release?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/omgcnb/bit_of_buildpack.rb', line 13

def needs_release?
  @unreleased_markdown.needs_release?
end

#tomlObject



21
22
23
# File 'lib/omgcnb/bit_of_buildpack.rb', line 21

def toml
  @toml
end