lib/quran/audio/command.rb in quran-audio-0.3.3 vs lib/quran/audio/command.rb in quran-audio-0.4.0
- old
+ new
@@ -2,39 +2,35 @@
module Quran::Audio
##
# The {Quran::Audio::Command Quran::Audio::Command} class
# is the superclass of all commands.
- class Command < Cmd
+ class Command
require_relative "command/ls"
require_relative "command/pull"
include FileUtils
- def method_missing(m, *ary, &b)
- Ryo.property?(options, m) ? options[m] : super
- end
+ ##
+ # @return [Ryo]
+ # Command-line options
+ attr_reader :options
- def respond_to_missing?(m, p = false)
- Ryo.property?(options, m) || super
+ ##
+ # @param [Ryo] options
+ def initialize(options)
+ @options = options
end
- def respond_to?(m, p = false)
- Ryo.property?(options, m) || super
- end
-
private
def dir
@dir ||= Ryo.from({
localbase: File.join(Dir.home, ".local"),
- rootdir: File.realpath(File.join(__dir__, "..", "..", "..")),
- sharedir: Ryo.memo { File.join(localbase, "share", "quran-audio") },
- datadir: Ryo.memo { File.join(rootdir, "share", "quran-audio", "data") }
+ share: Ryo.memo { File.join(localbase, "share", "quran-audio") },
+ root: File.realpath(File.join(__dir__, "..", "..", "..")),
+ erb: Ryo.memo { File.join(root, "share", "quran-audio", "erb") },
+ json: Ryo.memo { File.join(root, "share", "quran-audio", "json") },
})
- end
-
- def options
- @options ||= parse_options(argv)
end
def line
@line ||= IO::Line.new($stdout)
end