Class: BMT::Methodology

Inherits:
Object
  • Object
show all
Defined in:
lib/bmt/methodology.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, version:, attributes: {}) ⇒ Methodology

Returns a new instance of Methodology.



5
6
7
8
9
10
11
12
13
14
# File 'lib/bmt/methodology.rb', line 5

def initialize(key:, version:, attributes: {})
  @key = key
  @version = version
  @title = attributes.dig('metadata', 'title')
  @release_date = attributes.dig('metadata', 'release_date')
  @description = attributes.dig('metadata', 'description')
  @vrt_version = attributes.dig('metadata', 'vrt_version')

  @steps_data = attributes.dig('content', 'steps')
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/bmt/methodology.rb', line 3

def description
  @description
end

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/bmt/methodology.rb', line 3

def key
  @key
end

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/bmt/methodology.rb', line 3

def title
  @title
end

#versionObject (readonly)

Returns the value of attribute version.



3
4
5
# File 'lib/bmt/methodology.rb', line 3

def version
  @version
end

#vrt_versionObject (readonly)

Returns the value of attribute vrt_version.



3
4
5
# File 'lib/bmt/methodology.rb', line 3

def vrt_version
  @vrt_version
end

Instance Method Details

#release_dateObject



16
17
18
# File 'lib/bmt/methodology.rb', line 16

def release_date
  Date.parse(@release_date)
end

#stepsObject



20
21
22
23
24
25
26
27
# File 'lib/bmt/methodology.rb', line 20

def steps
  @steps ||= @steps_data.map do |step_data|
    Step.new(
      methodology: self,
      attributes: step_data
    )
  end
end