module Bundler::Thor::Actions::ClassMethods
公共实例方法
add_runtime_options!() 点击切换源代码
添加有助于操作执行的运行时选项。
# File bundler/vendor/thor/lib/thor/actions.rb, line 48 def add_runtime_options! class_option :force, type: :boolean, aliases: "-f", group: :runtime, desc: "Overwrite files that already exist" class_option :pretend, type: :boolean, aliases: "-p", group: :runtime, desc: "Run but do not make any changes" class_option :quiet, type: :boolean, aliases: "-q", group: :runtime, desc: "Suppress status output" class_option :skip, type: :boolean, aliases: "-s", group: :runtime, desc: "Skip files that already exist" end
source_paths() 点击切换源代码
为一个 Bundler::Thor 实例保存源路径。source_paths_for_search
方法负责从此当前类、继承的路径和源根收集 source_paths
。
# File bundler/vendor/thor/lib/thor/actions.rb, line 22 def source_paths @_source_paths ||= [] end
source_paths_for_search() 点击切换源代码
按以下顺序返回源路径
1) This class source paths 2) Source root 3) Parents source paths
# File bundler/vendor/thor/lib/thor/actions.rb, line 38 def source_paths_for_search paths = [] paths += source_paths paths << source_root if source_root paths += from_superclass(:source_paths, []) paths end
source_root(path = nil) 点击切换源代码
存储并返回此类的源根
# File bundler/vendor/thor/lib/thor/actions.rb, line 27 def source_root(path = nil) @_source_root = path if path @_source_root ||= nil end