Class: BMT::Step

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(methodology:, attributes:) ⇒ Step

Returns a new instance of Step.



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

def initialize(methodology:, attributes:)
  @methodology = methodology
  @key = attributes['key']
  @title = attributes['title']
  @description = attributes['description']
  @type = attributes['type']
  @items_data = attributes['items'] || []
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#keyObject (readonly)

Returns the value of attribute key.



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

def key
  @key
end

#methodologyObject (readonly)

Returns the value of attribute methodology.



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

def methodology
  @methodology
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#itemsObject



14
15
16
17
18
19
20
21
# File 'lib/bmt/step.rb', line 14

def items
  @items ||= @items_data.map do |item_data|
    Item.new(
      step: self,
      attributes: item_data
    )
  end
end