Module: Reading
- Defined in:
- lib/reading.rb,
lib/reading/item.rb,
lib/reading/config.rb,
lib/reading/errors.rb,
lib/reading/filter.rb,
lib/reading/version.rb,
lib/reading/item/view.rb,
lib/reading/parsing/csv.rb,
lib/reading/stats/query.rb,
lib/reading/stats/filter.rb,
lib/reading/parsing/parser.rb,
lib/reading/stats/grouping.rb,
lib/reading/stats/operation.rb,
lib/reading/item/time_length.rb,
lib/reading/util/hash_to_data.rb,
lib/reading/parsing/rows/blank.rb,
lib/reading/parsing/rows/column.rb,
lib/reading/parsing/transformer.rb,
lib/reading/parsing/rows/comment.rb,
lib/reading/parsing/rows/regular.rb,
lib/reading/util/hash_deep_merge.rb,
lib/reading/parsing/attributes/notes.rb,
lib/reading/parsing/attributes/title.rb,
lib/reading/parsing/attributes/author.rb,
lib/reading/parsing/attributes/genres.rb,
lib/reading/parsing/attributes/rating.rb,
lib/reading/parsing/attributes/shared.rb,
lib/reading/parsing/rows/custom_config.rb,
lib/reading/util/hash_array_deep_fetch.rb,
lib/reading/util/numeric_to_i_if_whole.rb,
lib/reading/parsing/attributes/variants.rb,
lib/reading/parsing/attributes/attribute.rb,
lib/reading/parsing/rows/compact_planned.rb,
lib/reading/util/hash_compact_by_template.rb,
lib/reading/parsing/attributes/experiences.rb,
lib/reading/stats/terminal_result_formatters.rb,
lib/reading/parsing/rows/regular_columns/head.rb,
lib/reading/parsing/rows/regular_columns/notes.rb,
lib/reading/parsing/rows/regular_columns/genres.rb,
lib/reading/parsing/rows/regular_columns/length.rb,
lib/reading/parsing/rows/regular_columns/rating.rb,
lib/reading/parsing/rows/regular_columns/history.rb,
lib/reading/parsing/rows/regular_columns/sources.rb,
lib/reading/parsing/rows/regular_columns/end_dates.rb,
lib/reading/parsing/rows/regular_columns/start_dates.rb,
lib/reading/parsing/rows/compact_planned_columns/head.rb,
lib/reading/parsing/attributes/experiences/spans_validator.rb,
lib/reading/parsing/attributes/experiences/history_transformer.rb,
lib/reading/parsing/attributes/experiences/dates_and_head_transformer.rb
Overview
TODO Refactor! This entire file has become 🤢🤮 with the accumulation of new features in the History column.
Goals of the refactor:
- if possible, avoid daily_spans; build spans with date ranges directly.
- validate spans at every step; that way the origin of bugs will be easier
to find, e.g. for the bug fixed in 6310639, spans became invalid in
#fix_open_ranges! and led to an error elsewhere that didn't give a trace
back to the origin.
- to facilitate the points above, create a class ExperienceBuilder to
contain much of the logic that is currently in this file.
Defined Under Namespace
Modules: Parsing, Stats, Util Classes: Config, ConfigError, Error, FileError, Filter, InputError, InvalidDateError, InvalidHeadError, InvalidHistoryError, Item, ParsingError, TooManyColumnsError
Constant Summary collapse
- VERSION =
'0.9.1'
Class Method Summary collapse
- .config ⇒ Hash
-
.filter ⇒ Object
Filters an array of Items.
-
.parse ⇒ Object
Parses a CSV file or string.
-
.stats ⇒ Object
Returns statistics on Items.
-
.time(string) ⇒ Item::TimeLength
A shortcut for getting a time from a string.
Class Method Details
.filter ⇒ Object
Filters an array of Items. See Filter::by for details.
43 44 45 |
# File 'lib/reading.rb', line 43 def self.filter(...) Filter.by(...) end |
.parse ⇒ Object
Parses a CSV file or string. See Parsing::CSV#initialize and #parse for details.
37 38 39 40 |
# File 'lib/reading.rb', line 37 def self.parse(...) csv = Parsing::CSV.new(...) csv.parse end |
.stats ⇒ Object
Returns statistics on Items. See Stats::Query#initialize and #result for details.
48 49 50 51 |
# File 'lib/reading.rb', line 48 def self.stats(...) query = Stats::Query.new(...) query.result end |
.time(string) ⇒ Item::TimeLength
A shortcut for getting a time from a string.
61 62 63 |
# File 'lib/reading.rb', line 61 def self.time(string) Item::TimeLength.parse(string) end |