lib/standup_md/file/helpers.rb in standup_md-0.3.5 vs lib/standup_md/file/helpers.rb in standup_md-0.3.6
- old
+ new
@@ -1,43 +1,41 @@
# frozen_string_literal: true
module StandupMD
class File
-
##
# Module responsible for reading and writing standup files.
module Helpers # :nodoc:
-
private
- def is_header?(line) # :nodoc:
+ def header?(line) # :nodoc:
line.match(header_regex)
end
- def is_sub_header?(line) # :nodoc:
+ def sub_header?(line) # :nodoc:
line.match(sub_header_regex)
end
def header_regex # :nodoc:
- %r{^#{'#' * StandupMD.config.file.header_depth}\s+}
+ /^#{'#' * StandupMD.config.file.header_depth}\s+/
end
def sub_header_regex # :nodoc:
- %r{^#{'#' * StandupMD.config.file.sub_header_depth}\s+}
+ /^#{'#' * StandupMD.config.file.sub_header_depth}\s+/
end
def bullet_character_regex # :nodoc:
- %r{\s*#{StandupMD.config.file.bullet_character}\s*}
+ /\s*#{StandupMD.config.file.bullet_character}\s*/
end
def determine_section_type(line) # :nodoc:
- line = line.sub(%r{^\#{#{StandupMD.config.file.sub_header_depth}}\s*}, '')
- [
- StandupMD.config.file.current_header,
- StandupMD.config.file.previous_header,
- StandupMD.config.file.impediments_header,
- StandupMD.config.file.notes_header
+ line = line.sub(/^\#{#{StandupMD.config.file.sub_header_depth}}\s*/, '')
+ [
+ StandupMD.config.file.current_header,
+ StandupMD.config.file.previous_header,
+ StandupMD.config.file.impediments_header,
+ StandupMD.config.file.notes_header
].each { |header| return header if line.include?(header) }
raise "Unrecognized header [#{line}]"
end
def new_entry(record) # :nodoc:
@@ -52,11 +50,11 @@
def header(date)
'#' * StandupMD.config.file.header_depth + ' ' + date.strftime(StandupMD.config.file.header_date_format)
end
- def sub_header(sh)
- '#' * StandupMD.config.file.sub_header_depth + ' ' + sh
+ def sub_header(subhead)
+ '#' * StandupMD.config.file.sub_header_depth + ' ' + subhead
end
end
end
end