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.



48
49
50
# File 'lib/octodown/support/file_chooser.rb', line 48

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



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

def logger
  @logger
end

Instance Method Details

#callObject



52
53
54
55
# File 'lib/octodown/support/file_chooser.rb', line 52

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

#winning_strategyObject



57
58
59
60
# File 'lib/octodown/support/file_chooser.rb', line 57

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