module LB::Project
Constants
- ERROR_MSG
- VERSION
Version
Public Class Methods
config()
click to toggle source
Get main configuration
@return [Config]
@api private
# File lib/lb/project.rb, line 116 def self.config @settings.config rescue NoMethodError raise ArgumentError, 'Call LB::Project.setup(...) first!' end
logger()
click to toggle source
# File lib/lb/project.rb, line 126 def self.logger @logger ||= create_logger end
public_path()
click to toggle source
Get public path
@return [dir_name]
@api private
# File lib/lb/project.rb, line 106 def self.public_path File.join(root, config.public_path) end
root()
click to toggle source
Get root path
@return [dir_name]
@api private
# File lib/lb/project.rb, line 68 def self.root @settings.root rescue NoMethodError raise ArgumentError, 'Call LB::Project.setup(...) first!' end
root_for(file, depth = 2)
click to toggle source
Get root path for file
@param [File] file The file to get the root path from @param [File] depth The depth of the given file relative from the root directory
@return [dir_name]
@api private
# File lib/lb/project.rb, line 84 def self.root_for(file, depth = 2) path = File.expand_path(file) depth.times { path = File.dirname(path) } path end
settings()
click to toggle source
# File lib/lb/project.rb, line 58 def self.settings @settings end
setup(settings)
click to toggle source
Setup
@param [settings] project settings
@return [self]
@api private
# File lib/lb/project.rb, line 47 def self.setup(settings) unless settings.is_a?(LB::Project::Settings) raise ArgumentError, ERROR_MSG end @settings = settings self end
t(*params)
click to toggle source
# File lib/lb/project.rb, line 122 def self.t(*params) R18n.t(*params) end
template_path()
click to toggle source
Get template path
@return [dir_name]
@api private
# File lib/lb/project.rb, line 96 def self.template_path File.join(root, config.template_path) end
Private Class Methods
create_logger()
click to toggle source
# File lib/lb/project.rb, line 130 def self.create_logger logger = Logger.new(STDOUT) logger.level = Logger::INFO logger end