Sha256: 88f9c802482a9ac674f8120ea37365e652f7c865b3dbc646a8b6fb7222a5a6a6

Contents?: true

Size: 599 Bytes

Versions: 43

Compression:

Stored size: 599 Bytes

Contents

# frozen_string_literal: true

require "refinements/strings"

module Pennyworth
  module Loaders
    # Loads an array of text records.
    class Text
      using Refinements::Strings

      TRANSFORMS = %w[camelcase capitalize downcase size snakecase titleize upcase].freeze

      def initialize transforms: TRANSFORMS, model: Models::Text
        @transforms = transforms
        @model = model
      end

      def call content
        transforms.map { |kind| model[id: kind, content: content.public_send(kind)] }
      end

      private

      attr_reader :transforms, :model
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
pennyworth-15.4.1 lib/pennyworth/loaders/text.rb
pennyworth-15.4.0 lib/pennyworth/loaders/text.rb
pennyworth-15.3.0 lib/pennyworth/loaders/text.rb
pennyworth-15.2.0 lib/pennyworth/loaders/text.rb
pennyworth-15.1.1 lib/pennyworth/loaders/text.rb
pennyworth-15.1.0 lib/pennyworth/loaders/text.rb
pennyworth-15.0.3 lib/pennyworth/loaders/text.rb
pennyworth-15.0.2 lib/pennyworth/loaders/text.rb
pennyworth-15.0.1 lib/pennyworth/loaders/text.rb
pennyworth-15.0.0 lib/pennyworth/loaders/text.rb
pennyworth-14.3.0 lib/pennyworth/loaders/text.rb
pennyworth-14.2.1 lib/pennyworth/loaders/text.rb
pennyworth-14.2.0 lib/pennyworth/loaders/text.rb
pennyworth-14.1.2 lib/pennyworth/loaders/text.rb
pennyworth-14.1.1 lib/pennyworth/loaders/text.rb
pennyworth-14.1.0 lib/pennyworth/loaders/text.rb
pennyworth-14.0.0 lib/pennyworth/loaders/text.rb
pennyworth-13.8.0 lib/pennyworth/loaders/text.rb
pennyworth-13.7.0 lib/pennyworth/loaders/text.rb
pennyworth-13.6.0 lib/pennyworth/loaders/text.rb