Class: Pennyworth::Loaders::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/pennyworth/loaders/text.rb

Overview

Loads an array of text records.

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(transforms: TRANSFORMS, model: Models::Text) ⇒ Text

Returns a new instance of Text.



13
14
15
16
# File 'lib/pennyworth/loaders/text.rb', line 13

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

Instance Method Details

#call(content) ⇒ Object



18
19
20
# File 'lib/pennyworth/loaders/text.rb', line 18

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