Class: Foshow

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/foshow.rb

Constant Summary collapse

VERSION =
"0.0.0"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rendererObject

Returns the value of attribute renderer.



10
11
12
# File 'lib/foshow.rb', line 10

def renderer
  @renderer
end

#viewsObject

Returns the value of attribute views.



10
11
12
# File 'lib/foshow.rb', line 10

def views
  @views
end

Class Method Details

.configure {|instance.config| ... } ⇒ Object

Yields:



12
13
14
# File 'lib/foshow.rb', line 12

def self.configure(&block)
  yield instance.config
end

.render(renderer) ⇒ Object



16
17
18
19
# File 'lib/foshow.rb', line 16

def self.render(renderer)
  instance.renderer = renderer
  instance.render
end

Instance Method Details

#configObject



21
22
23
# File 'lib/foshow.rb', line 21

def config
  @config ||= OpenStruct.new
end

#renderObject



25
26
27
28
29
# File 'lib/foshow.rb', line 25

def render
  renderer.(:section, id: 'code_viewer') do
    build_navigation + build_elements
  end.html_safe
end