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.



26
27
28
29
# File 'lib/markdoc/sequence.rb', line 26

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.



25
26
27
# File 'lib/markdoc/sequence.rb', line 25

def active
  @active
end

#idObject

Returns the value of attribute id.



25
26
27
# File 'lib/markdoc/sequence.rb', line 25

def id
  @id
end

#labelObject

Returns the value of attribute label.



25
26
27
# File 'lib/markdoc/sequence.rb', line 25

def label
  @label
end

#typeObject

Returns the value of attribute type.



25
26
27
# File 'lib/markdoc/sequence.rb', line 25

def type
  @type
end

Instance Method Details

#activateObject



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

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

#deactivateObject



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

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