Class: Confluence::Page::Details

Inherits:
Hash
  • Object
show all
Defined in:
lib/confluence/page.rb

Constant Summary

REGEXP =
/\{details:label=([^\}]+)\}([^\{}]*)\{details\}/m
PAIR_REGEXP =
/([^:]+):([^\n]+)/m

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Details) initialize(args)

Returns a new instance of Details



11
12
13
14
15
# File 'lib/confluence/page.rb', line 11

def initialize(args)
  @label = args[:label]
  
  parse(args[:content])
end

Instance Attribute Details

- (Object) label (readonly)

Returns the value of attribute label



9
10
11
# File 'lib/confluence/page.rb', line 9

def label
  @label
end

Instance Method Details

- (Object) to_s



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/confluence/page.rb', line 17

def to_s
  # details macro
  content = "{details:label=#{label}}\n"
  
  each_pair do |key, value|
    content << "#{key}:#{value}\n"
  end
  
  # end of details macro
  content << "{details}\n"
end