Module: ReleaseHx::RHYML
- Defined in:
- lib/releasehx/rhyml.rb,
lib/releasehx/rhyml/adapter.rb,
lib/releasehx/rhyml/change.rb,
lib/releasehx/rhyml/liquid.rb,
lib/releasehx/rhyml/loaders.rb,
lib/releasehx/rhyml/release.rb
Overview
RHYML (Release History YAML) is the core data modeling language for ReleaseHx.
This module provides the components for loading, validating, and transforming
RHYML data.
Defined Under Namespace
Modules: RHYMLFilters Classes: Adapter, Change, History, Loader, MappingLoader, Release, ReleaseLoader
Class Method Summary collapse
-
.pasterize(input) ⇒ String
Converts verbs in input text to past tense using the verb mapping dictionary.
-
.verb_past_tenses ⇒ Hash
Loads verb past tense mappings from YAML file for pasterization.
Class Method Details
.pasterize(input) ⇒ String
Converts verbs in input text to past tense using the verb mapping dictionary.
Preserves original casing (uppercase, capitalized, lowercase) of the words.
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
# File 'lib/releasehx/rhyml/adapter.rb', line 729 def self.pasterize input return input if input.nil? || input.empty? input.gsub(/\b(\w+)\b/) do |word| replacement = verb_past_tenses[word.downcase] next word unless replacement # Preserve casing if word == word.upcase replacement.upcase elsif word == word.capitalize replacement.capitalize else replacement end end end |
.verb_past_tenses ⇒ Hash
Loads verb past tense mappings from YAML file for pasterization.
717 718 719 720 721 722 |
# File 'lib/releasehx/rhyml/adapter.rb', line 717 def self.verb_past_tenses @verb_past_tenses ||= begin yaml_path = File.('mappings/verb_past_tenses.yml', __dir__) YAML.load_file(yaml_path) end end |