class StandupMD::Config::File
The configuration class for StandupMD::File
Constants
- DEFAULTS
The default options.
@return [Hash]
Attributes
Character used as bullets for list entries.
@return [String] either - (dash) or * (asterisk)
@default “-” (dash)
Should the file be created if it doesn't exist?
@param [Boolean] create
@return [boolean]
String to be used as “Current” header.
@param [String] header
@return [String]
@default “Current”
The directory in which the files are located.
@return [String]
@default “~/.cache/standup_md”
The date format for entry headers. Will be parsed by strftime
.
@param [String] format
@return [String]
Number of octothorps that should preface entry headers.
@return [Integer] between 1 and 5
@default 1
String to be used as “Impediments” header.
@param [String] header
@return [String]
@default “Impediments”
Format to be used for standup file names. Should be parse-able by strftime, and should be a monthly date.
@param [String] name_format
@return [String]
@default “%Y_%m.md”
String to be used as “Notes” header.
@param [String] header
@return [String]
@default “Notes”
String to be used as “Previous” header.
@param [String] header
@return [String]
@default “Previous”
Number of octothorps that should preface sub-headers.
@return [Integer] between 2 and 6
@default 2
Preferred order for sub-headers.
@param [Array] sub_header_order
@return [Array]
@default %w[previous current impediment notes]
Public Class Methods
Initializes the config with default values.
# File lib/standup_md/config/file.rb, line 140 def initialize reset end
Public Instance Methods
Setter for bullet_character. Must be * (asterisk) or - (dash).
@param [String] character
@return [String]
# File lib/standup_md/config/file.rb, line 189 def bullet_character=(char) raise 'Must be "-" or "*"' unless %w[- *].include?(char) @bullet_character = char end
Setter for directory. Must be expanded in case the user uses `~` for home. If the directory doesn't exist, it will be created. To reset instance variables after changing the directory, you'll need to call load.
@param [String] directory
@return [String]
# File lib/standup_md/config/file.rb, line 202 def directory=(directory) @directory = ::File.expand_path(directory).tap do |directory| FileUtils.mkdir_p(directory) unless ::File.directory?(directory) end end
Number of octothorps (#) to use before the main header.
@param [Integer] depth
@return [Integer]
# File lib/standup_md/config/file.rb, line 158 def header_depth=(depth) if !depth.between?(1, 5) raise 'Header depth out of bounds (1..5)' elsif depth >= sub_header_depth @sub_header_depth = depth + 1 end @header_depth = depth end
Sets all config values back to their defaults.
@return [Hash]
# File lib/standup_md/config/file.rb, line 148 def reset DEFAULTS.each { |k, v| instance_variable_set("@#{k}", v) } end
Number of octothorps (#) to use before sub headers (Current, Previous, etc).
@param [Integer] depth
@return [Integer]
# File lib/standup_md/config/file.rb, line 174 def sub_header_depth=(depth) if !depth.between?(2, 6) raise 'Sub-header depth out of bounds (2..6)' elsif depth <= header_depth @header_depth = depth - 1 end @sub_header_depth = depth end