Sha256: 1ee4e21cdc2135fc9bcb70b5678b3b5d09cc546998c29e265f0bb2c803be5442
Contents?: true
Size: 582 Bytes
Versions: 2
Compression:
Stored size: 582 Bytes
Contents
module Tocer # Default configuration for gem with support for custom settings. class Configuration attr_reader :file_path attr_writer :label def initialize file_path: File.join(ENV["HOME"], Identity.file_name) @file_path = file_path @settings = load_settings end def label @label ||= settings.fetch(:label, "# Table of Contents") end private attr_reader :settings def load_settings return {} unless File.exist?(file_path) yaml = YAML.load_file file_path yaml.is_a?(Hash) ? yaml : {} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tocer-2.0.0 | lib/tocer/configuration.rb |
tocer-1.0.0 | lib/tocer/configuration.rb |