Sha256: 7f07dd51132924ff684dcf5b179c30f8200304c46aed3b70cba4c4b9f46e498a

Contents?: true

Size: 596 Bytes

Versions: 1

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true

module Quran::Audio
  class Command::Ls < Command
    set_banner usage: "quran-audio ls [OPTIONS]",
               description: "List reciters"

    def run
      authors  = Ryo.from_json(path: File.join(dir.datadir, "authors.json"))
      template = File.binread(File.join(dir.datadir, "erb", "author.txt.erb"))
      render(authors, template)
    end

    private

    def render(authors, template)
      puts Ryo.each(authors).map { |switch, author|
        ERB.new(template).result_with_hash({switch:, author: Ryo(author)})
      }.join("\n")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quran-audio-0.3.1 lib/quran/audio/command/ls.rb