Class: Octodown::FileChooser::MarkdownFileList

Inherits:
Object
  • Object
show all
Defined in:
lib/octodown/support/file_chooser.rb

Defined Under Namespace

Classes: Git, Glob

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ MarkdownFileList

Returns a new instance of MarkdownFileList.



46
47
48
# File 'lib/octodown/support/file_chooser.rb', line 46

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



44
45
46
# File 'lib/octodown/support/file_chooser.rb', line 44

def logger
  @logger
end

Instance Method Details

#callObject



50
51
52
53
# File 'lib/octodown/support/file_chooser.rb', line 50

def call
  logger.debug("File choose strategy: #{winning_strategy.class.name}")
  winning_strategy.call
end

#winning_strategyObject



55
56
57
58
# File 'lib/octodown/support/file_chooser.rb', line 55

def winning_strategy
  strats = [Git.new, Glob.new]
  @winning_strategy ||= strats.find(&:runnable?)
end