Class: SimpleCV::Basic

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_cv/basic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_path:) ⇒ Basic

Returns a new instance of Basic.



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

def initialize config_path:
  @config = build_struct_tree parse_config_file config_path
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/simple_cv/basic.rb', line 8

def config
  @config
end

Instance Method Details

#render_file(filename: "SimpleCV", path: nil) ⇒ Object

Render file

With given path and filename, pdf can be rendered to a specific location. If no arguments are given, filename will be set to SimpleCV.pdf and pdf will be rendered to current working dir.



20
21
22
23
24
# File 'lib/simple_cv/basic.rb', line 20

def render_file filename: "SimpleCV", path: nil
  output_path = File.join(path || Dir.pwd, "#{filename.chomp('.pdf')}.pdf")
  Layout.new(config: @config).render_file(output_path)
  output_path
end