Module: Metior::VCS
Overview
This module provides functionality to automatically register new VCS
implementations Module
s
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(mod) ⇒ Object
Including
VCS
will make aModule
available as a supported VCS type in Metior.
Instance Method Summary collapse
-
#support!(feature) ⇒ Object
Checks if a specific feature is supported by the VCS (or its implementation) and raises an error if the feature is not available.
-
#supports?(feature) ⇒ true, false
Checks if a specific feature is supported by the VCS (or its implementation).
-
#vcs ⇒ Metior::VCS
Returns the VCS module that is included by this object.
Class Method Details
.included(mod) ⇒ Object
Including VCS
will make a Module
available as a supported VCS type in
Metior
114 115 116 117 118 119 120 121 122 123 |
# File 'lib/metior/vcs.rb', line 114 def self.included(mod) mod.extend ClassMethods mod.send :class_variable_set, :@@features, { :file_stats => true, :line_stats => true } raise "#{mod}::NAME is not set." unless mod.const_defined? :NAME Metior.vcs_types[mod::NAME.to_sym] = mod end |
Instance Method Details
#support!(feature) ⇒ Object
Checks if a specific feature is supported by the VCS (or its implementation) and raises an error if the feature is not available
131 132 133 |
# File 'lib/metior/vcs.rb', line 131 def support!(feature) raise UnsupportedError.new(vcs) unless supports? feature end |
#supports?(feature) ⇒ true, false
Checks if a specific feature is supported by the VCS (or its implementation)
140 141 142 |
# File 'lib/metior/vcs.rb', line 140 def supports?(feature) vcs.supports? feature end |
#vcs ⇒ Metior::VCS
Returns the VCS module that is included by this object
148 149 150 |
# File 'lib/metior/vcs.rb', line 148 def vcs Metior.vcs_types[singleton_class::NAME.to_sym] end |