Class: Kramdown::PlantUml::Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/kramdown-plantuml/theme.rb

Overview

Provides theming support for PlantUML

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Theme

Returns a new instance of Theme.

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
22
# File 'lib/kramdown-plantuml/theme.rb', line 13

def initialize(options)
  raise ArgumentError, 'options cannot be nil' if options.nil?
  raise ArgumentError, "options must be a '#{Options}'." unless options.is_a?(Options)

  @raise_errors = options.raise_errors?
  @logger = LogWrapper.init
  @name = options.theme_name
  @scale = options.scale
  @directory = resolve options.theme_directory
end

Instance Attribute Details

#directoryObject (readonly)

Returns the value of attribute directory.



11
12
13
# File 'lib/kramdown-plantuml/theme.rb', line 11

def directory
  @directory
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/kramdown-plantuml/theme.rb', line 11

def name
  @name
end

#scaleObject (readonly)

Returns the value of attribute scale.



11
12
13
# File 'lib/kramdown-plantuml/theme.rb', line 11

def scale
  @scale
end

Instance Method Details

#apply(plantuml) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/kramdown-plantuml/theme.rb', line 24

def apply(plantuml)
  if plantuml.nil? || !plantuml.is_a?(String) || plantuml.empty?
    @logger.debug 'Empty diagram or not a String.'
    return plantuml
  end

  theme(plantuml)
end