Class: LL::Step

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_document, document_version:) ⇒ Step

Returns a new instance of Step.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ll/step.rb', line 15

def initialize json_document, document_version:
  # TODO: Auto convert dasherized to underscore
  data = json_document.to_h.symbolize_keys

  @document_version = document_version || LL::VERSION

  @title       = data[:title]
  @description = data[:description]
  @action      = data[:action]
  @kind        = data[:kind]
  @status      = data[:status]
  @identifier  = data[:identifier]
  @schema      = data[:schema]
  @by          = data[:by]
  @via         = data[:via]
  @os          = data[:via]
  @with        = data[:via]
  @action_at   = data[:action_at]
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



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

def action
  @action
end

#action_atObject (readonly)

Returns the value of attribute action_at.



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

def action_at
  @action_at
end

#byObject (readonly)

Returns the value of attribute by.



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

def by
  @by
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#identifierObject (readonly)

Returns the value of attribute identifier.



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

def identifier
  @identifier
end

#kindObject (readonly)

Returns the value of attribute kind.



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

def kind
  @kind
end

#schemaObject (readonly)

Returns the value of attribute schema.



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

def schema
  @schema
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#versionObject (readonly)

Returns the value of attribute version.



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

def version
  @version
end

#viaObject (readonly)

Returns the value of attribute via.



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

def via
  @via
end

Instance Method Details

#reformatObject

This is useful to upgrade formats between versions.

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/ll/step.rb', line 36

def reformat
  raise NotImplementedError
end

#to_hObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ll/step.rb', line 40

def to_h
  { title: title,
    description: description,
    action: action,
    kind: kind,
    status: status,
    identifier: identifier,
    by: by,
    via: via,
    action_at: action_at }
end

#vv_jsonObject



52
53
54
# File 'lib/ll/step.rb', line 52

def vv_json
  self.to_h.vv_json
end