lib/thinreports/layout/base.rb in thinreports-0.9.1 vs lib/thinreports/layout/base.rb in thinreports-0.10.0
- old
+ new
@@ -1,21 +1,20 @@
-# coding: utf-8
+# frozen_string_literal: true
module Thinreports
module Layout
-
class Base
- EXT_NAME = 'tlf'
+ EXT_NAME = 'tlf'.freeze
include Utils
class << self
# @param [String] filename
# @return [Thinreports::Layout::Format]
# @raise [Thinreports::Errors::InvalidLayoutFormat]
# @raise [Thinreports::Errors::IncompatibleLayoutFormat]
def load_format(filename)
- filename += ".#{EXT_NAME}" unless filename =~/\.#{EXT_NAME}$/
+ filename += ".#{EXT_NAME}" unless filename =~ /\.#{EXT_NAME}$/
unless File.exist?(filename)
raise Thinreports::Errors::LayoutFileNotFound
end
# Build format.
@@ -34,17 +33,16 @@
# @param [String] filename
# @param [Hash] options
# @option options [Symbol] :id (nil)
def initialize(filename, options = {})
@filename = filename
- @format = self.class.load_format(filename)
- @id = options[:id]
+ @format = self.class.load_format(filename)
+ @id = options[:id]
end
# @return [Boolean] Return the true if is default layout.
def default?
@id.nil?
end
end
-
end
end