Class: Pennyworth::Loaders::Text
- Inherits:
-
Object
- Object
- Pennyworth::Loaders::Text
- 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
- #call(content) ⇒ Object
-
#initialize(transforms: TRANSFORMS, model: Models::Text) ⇒ Text
constructor
A new instance of Text.
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 |