class StandupMD::Config::File
The configuration class for StandupMD::File
Constants
- CONFIG_ATTRIBUTES
-
Attributes copied into request-scoped config snapshots.
@return [Array<Symbol>]
- 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”
Number of spaces used for each nested task level.
@return [Integer]
@default 2
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
Source
# File lib/standup_md/config/file.rb, line 153 def initialize reset end
Initializes the config with default values.
Public Instance Methods
Source
# File lib/standup_md/config/file.rb, line 222 def bullet_character=(char) raise 'Must be "-" or "*"' unless %w[- *].include?(char) @bullet_character = char end
Setter for bullet_character. Must be * (asterisk) or - (dash).
@param [String] character
@return [String]
Source
# File lib/standup_md/config/file.rb, line 169 def copy self.class.new.copy_from(self) end
Builds an independent copy of this file config.
@return [StandupMD::Config::File]
Source
# File lib/standup_md/config/file.rb, line 179 def copy_from(config) CONFIG_ATTRIBUTES.each do |attribute| instance_variable_set( "@#{attribute}", copy_default(config.public_send(attribute)) ) end self end
Copies values from another file config.
@param [StandupMD::Config::File] config
@return [StandupMD::Config::File]
Source
# File lib/standup_md/config/file.rb, line 247 def directory=(directory) @directory = ::File.expand_path(directory) end
Setter for directory. Must be expanded in case the user uses ‘~` for home. Directory creation is handled by StandupMD::File.
@param [String] directory
@return [String]
Source
# File lib/standup_md/config/file.rb, line 195 def header_depth=(depth) raise "Header depth out of bounds (1..5)" if !depth.between?(1, 5) @sub_header_depth = depth + 1 if depth >= sub_header_depth @header_depth = depth end
Number of octothorps (#) to use before the main header.
@param [Integer] depth
@return [Integer]
Source
# File lib/standup_md/config/file.rb, line 234 def indent_width=(width) raise "Indent width must be a positive integer" unless width.is_a?(Integer) && width.positive? @indent_width = width end
Setter for indent_width. Must be a positive integer.
@param [Integer] width
@return [Integer]
Source
# File lib/standup_md/config/file.rb, line 161 def reset DEFAULTS.each { |k, v| instance_variable_set("@#{k}", copy_default(v)) } end
Sets all config values back to their defaults.
@return [Hash]
Source
# File lib/standup_md/config/file.rb, line 209 def sub_header_depth=(depth) raise "Sub-header depth out of bounds (2..6)" if !depth.between?(2, 6) @header_depth = depth - 1 if depth <= header_depth @sub_header_depth = depth end
Number of octothorps (#) to use before sub headers (Current, Previous, etc).
@param [Integer] depth
@return [Integer]