Class: Markdoc::Sequence::Role

Inherits:
Object
  • Object
show all
Defined in:
lib/markdoc/sequence.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, id, label) ⇒ Role

Returns a new instance of Role.



30
31
32
33
# File 'lib/markdoc/sequence.rb', line 30

def initialize(type, id, label)
  self.type, self.id, self.label = type, id, label
  self.active = false
end

Instance Attribute Details

#activeObject

Returns the value of attribute active.



29
30
31
# File 'lib/markdoc/sequence.rb', line 29

def active
  @active
end

#idObject

Returns the value of attribute id.



29
30
31
# File 'lib/markdoc/sequence.rb', line 29

def id
  @id
end

#labelObject

Returns the value of attribute label.



29
30
31
# File 'lib/markdoc/sequence.rb', line 29

def label
  @label
end

#typeObject

Returns the value of attribute type.



29
30
31
# File 'lib/markdoc/sequence.rb', line 29

def type
  @type
end

Instance Method Details

#activateObject



34
35
36
37
38
# File 'lib/markdoc/sequence.rb', line 34

def activate
  return if active
  self.active = true
  "active(#{id});"
end

#deactivateObject



39
40
41
42
43
# File 'lib/markdoc/sequence.rb', line 39

def deactivate
  return unless active
  self.active = false
  "inactive(#{id});"
end