Class: Confinement::Rendering::Guesser
- Inherits:
-
Object
- Object
- Confinement::Rendering::Guesser
- Defined in:
- lib/confinement.rb
Instance Method Summary collapse
- #call(path) ⇒ Object
-
#initialize(guessing_registry) ⇒ Guesser
constructor
A new instance of Guesser.
Constructor Details
#initialize(guessing_registry) ⇒ Guesser
Returns a new instance of Guesser.
537 538 539 |
# File 'lib/confinement.rb', line 537 def initialize(guessing_registry) @guessing_registry = guessing_registry end |
Instance Method Details
#call(path) ⇒ Object
541 542 543 544 545 546 547 548 549 550 551 552 553 |
# File 'lib/confinement.rb', line 541 def call(path) basename = path.basename.to_s extensions = basename.split(".")[1..-1] extensions.reverse.filter_map do |extension| next if !@guessing_registry.key?(extension) guess = @guessing_registry[extension] guess = guess.call if guess.is_a?(Proc) guess end end |