Class: Booky::Layout::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/booky/layout/element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, document, layout, ast = nil, index = nil) ⇒ Element

Returns a new instance of Element.



9
10
11
# File 'lib/booky/layout/element.rb', line 9

def initialize(options, document, layout, ast = nil, index = nil)
  @options, @document, @layout, @ast, @index = options, document, layout, ast, index
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



24
25
26
# File 'lib/booky/layout/element.rb', line 24

def method_missing(m, *args, &block)
  @document.send(m, *args, &block)
end

Instance Attribute Details

#astObject

Returns the value of attribute ast.



5
6
7
# File 'lib/booky/layout/element.rb', line 5

def ast
  @ast
end

#documentObject

Returns the value of attribute document.



7
8
9
# File 'lib/booky/layout/element.rb', line 7

def document
  @document
end

#indexObject

Returns the value of attribute index.



6
7
8
# File 'lib/booky/layout/element.rb', line 6

def index
  @index
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/booky/layout/element.rb', line 4

def options
  @options
end

Instance Method Details

#next_optionObject



20
21
22
# File 'lib/booky/layout/element.rb', line 20

def next_option
  @ast[@index+1]
end

#previous_optionObject



16
17
18
# File 'lib/booky/layout/element.rb', line 16

def previous_option
  @ast[@index-1]
end

#to_prawnObject



13
14
# File 'lib/booky/layout/element.rb', line 13

def to_prawn
end