Class: Thinreports::BasicReport::Layout::Base
- Inherits:
-
Object
- Object
- Thinreports::BasicReport::Layout::Base
- Includes:
- Utils
- Defined in:
- lib/thinreports/basic_report/layout/base.rb
Constant Summary collapse
- EXT_NAME =
'tlf'
Instance Attribute Summary collapse
- #filename ⇒ String readonly
-
#format ⇒ Object
readonly
Returns the value of attribute format.
- #id ⇒ Symbol readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#default? ⇒ Boolean
Return the true if is default layout.
-
#initialize(filename, options = {}) ⇒ Base
constructor
A new instance of Base.
Methods included from Utils
#blank_value?, #call_block_in, #deep_copy, included
Constructor Details
#initialize(filename, options = {}) ⇒ Base
Returns a new instance of Base.
35 36 37 38 39 |
# File 'lib/thinreports/basic_report/layout/base.rb', line 35 def initialize(filename, = {}) @filename = filename @format = self.class.load_format(filename) @id = [:id] end |
Instance Attribute Details
#filename ⇒ String (readonly)
27 28 29 |
# File 'lib/thinreports/basic_report/layout/base.rb', line 27 def filename @filename end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
24 25 26 |
# File 'lib/thinreports/basic_report/layout/base.rb', line 24 def format @format end |
#id ⇒ Symbol (readonly)
30 31 32 |
# File 'lib/thinreports/basic_report/layout/base.rb', line 30 def id @id end |
Class Method Details
.load_format(filename) ⇒ Thinreports::BasicReport::Layout::Format
15 16 17 18 19 20 21 |
# File 'lib/thinreports/basic_report/layout/base.rb', line 15 def load_format(filename) filename += ".#{EXT_NAME}" unless filename =~ /\.#{EXT_NAME}$/ raise Thinreports::BasicReport::Errors::LayoutFileNotFound unless File.exist?(filename) # Build format. Thinreports::BasicReport::Layout::Format.build(filename) end |
Instance Method Details
#default? ⇒ Boolean
Return the true if is default layout.
42 43 44 |
# File 'lib/thinreports/basic_report/layout/base.rb', line 42 def default? @id.nil? end |