Class: Images::Builder
- Inherits:
-
Object
- Object
- Images::Builder
- Defined in:
- lib/images/builder.rb
Instance Method Summary collapse
- #call(options) ⇒ Object
-
#initialize(args) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(args) ⇒ Builder
Returns a new instance of Builder.
4 5 6 7 |
# File 'lib/images/builder.rb', line 4 def initialize(args) @directory = args.fetch(:directory) @helper = args.fetch(:helper) end |
Instance Method Details
#call(options) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/images/builder.rb', line 9 def call() images_paths .map { |path| get_short_path(path) } .select { |path| .whitelist.include?(path.extname.slice(1,10)) } .reduce({}) { |acc, path| split = split_path(path) asset = @helper.call(path) append_nested_path(acc, split, asset) } end |