Class: Asciidoctor::PDF::ThemeData

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoctor/pdf/theme_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = nil) ⇒ ThemeData

Returns a new instance of ThemeData.



8
9
10
# File 'lib/asciidoctor/pdf/theme_data.rb', line 8

def initialize data = nil
  @table = (data || {}).transform_keys(&:to_sym)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/asciidoctor/pdf/theme_data.rb', line 36

def method_missing name, *args
  if (name_str = name.to_s).end_with? '='
    @table[name_str.chop.to_sym] = args[0]
  else
    @table[name]
  end
end

Instance Attribute Details

#tableObject (readonly)

Returns the value of attribute table.



6
7
8
# File 'lib/asciidoctor/pdf/theme_data.rb', line 6

def table
  @table
end

Instance Method Details

#[](name) ⇒ Object



12
13
14
# File 'lib/asciidoctor/pdf/theme_data.rb', line 12

def [] name
  @table[name.to_sym]
end

#[]=(name, value) ⇒ Object



16
17
18
# File 'lib/asciidoctor/pdf/theme_data.rb', line 16

def []= name, value
  @table[name.to_sym] = value
end

#delete_field(name) ⇒ Object



28
29
30
# File 'lib/asciidoctor/pdf/theme_data.rb', line 28

def delete_field name
  @table.delete name
end

#dupObject



32
33
34
# File 'lib/asciidoctor/pdf/theme_data.rb', line 32

def dup
  ThemeData.new @table
end

#each_pair(&block) ⇒ Object



20
21
22
# File 'lib/asciidoctor/pdf/theme_data.rb', line 20

def each_pair &block
  @table.each_pair(&block)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/asciidoctor/pdf/theme_data.rb', line 24

def eql? other
  @table.to_h.eql? other.to_h
end

#respond_to?(name, _include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/asciidoctor/pdf/theme_data.rb', line 44

def respond_to? name, _include_all = false
  @table.key? name.to_sym
end

#respond_to_missing?(name, _include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/asciidoctor/pdf/theme_data.rb', line 48

def respond_to_missing? name, _include_all = false
  @table.key? name.to_sym
end

#to_hObject



52
53
54
# File 'lib/asciidoctor/pdf/theme_data.rb', line 52

def to_h
  @table
end