Sha256: ac5964a6d21d7348fac28ec73d26241e7bd6d5560eaee9df1e40ab0536987f55
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true require "dry/inflector" module Bridgetown class Inflector < Dry::Inflector def initialize(&) # rubocop:disable Lint/MissingSuper @inflections = Dry::Inflector::Inflections.build do |inflections| inflections.acronym "HTML" inflections.acronym "CSS" inflections.acronym "JS" end configure(&) if block_given? end def configure yield inflections end # for compatibility with Zeitwerk def camelize(basename, *) super(basename) end def to_s "#<Bridgetown::Inflector>" end alias_method :inspect, :to_s def ==(other) return super unless other.is_a?(Bridgetown::Inflector) # NOTE: strictly speaking, this might be wrong if two inflector instances have different # rule sets…but as this equality check is mainly done within the automated test suite, we # just assume two instances are equal. No production apps will need multiple, # differently-configured inflectors running at once ;) true end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bridgetown-core-2.0.0.beta3 | lib/bridgetown-core/inflector.rb |
bridgetown-core-2.0.0.beta2 | lib/bridgetown-core/inflector.rb |
bridgetown-core-2.0.0.beta1 | lib/bridgetown-core/inflector.rb |