class Thinreports::Layout::Base

Constants

EXT_NAME

Attributes

filename[R]

@return [String]

format[R]
id[R]

@return [Symbol]

Public Class Methods

load_format(filename) click to toggle source

@param [String] filename @return [Thinreports::Layout::Format] @raise [Thinreports::Errors::InvalidLayoutFormat] @raise [Thinreports::Errors::IncompatibleLayoutFormat]

# File lib/thinreports/layout/base.rb, line 14
def load_format(filename)
  filename += ".#{EXT_NAME}" unless filename =~ /\.#{EXT_NAME}$/

  raise Thinreports::Errors::LayoutFileNotFound unless File.exist?(filename)
  # Build format.
  Thinreports::Layout::Format.build(filename)
end
new(filename, options = {}) click to toggle source

@param [String] filename @param [Hash] options @option options [Symbol] :id (nil)

# File lib/thinreports/layout/base.rb, line 34
def initialize(filename, options = {})
  @filename = filename
  @format = self.class.load_format(filename)
  @id = options[:id]
end

Public Instance Methods

default?() click to toggle source

@return [Boolean] Return the true if is default layout.

# File lib/thinreports/layout/base.rb, line 41
def default?
  @id.nil?
end