Module: Metior::VCS::ClassMethods
- Defined in:
- lib/metior/vcs.rb
Overview
This module provided class methods for VCS implementation Module
s that
implement smart auto-loading of dependencies and classes.
Instance Method Summary collapse
-
#const_missing(const) ⇒ Object
Missing constants may indicate.
-
#init ⇒ Object
This initializes the VCS's implementation
Module
. -
#not_supported(*features) ⇒ Object
Marks one or more features as not supported by the VCSs (or its implementation).
-
#supports?(feature) ⇒ true, false
Checks if a specific feature is supported by the VCS (or its implementation).
Instance Method Details
#const_missing(const) ⇒ Object
Missing constants may indicate
Trying to access either the Actor
, Commit
or Repository
class
in a VCS Module
will trigger auto-loading first.
54 55 56 57 58 |
# File 'lib/metior/vcs.rb', line 54 def const_missing(const) init if [:Actor, :Commit, :Repository].include?(const) super unless const_defined? const const_get const end |
#init ⇒ Object
This initializes the VCS's implementation Module
This requires the Actor
, Commit
and Repository
classes for that
VCS implementation.
64 65 66 67 68 69 70 71 |
# File 'lib/metior/vcs.rb', line 64 def init path = self::NAME.to_s require "metior/#{path}/actor" require "metior/#{path}/commit" require "metior/#{path}/repository" self end |
#not_supported(*features) ⇒ Object
Marks one or more features as not supported by the VCSs (or its implementation)
78 79 80 81 82 |
# File 'lib/metior/vcs.rb', line 78 def not_supported(*features) features.each do |feature| self.send(:class_variable_get, :@@features)[feature] = false end end |
#supports?(feature) ⇒ true, false
Checks if a specific feature is supported by the VCS (or its implementation)
91 92 93 |
# File 'lib/metior/vcs.rb', line 91 def supports?(feature) self.send(:class_variable_get, :@@features)[feature] == true end |