Class: Autoloaded::Specifications Private
- Inherits:
-
Object
- Object
- Autoloaded::Specifications
- Defined in:
- lib/autoloaded/specifications.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Holds regulations for autoloading.
Instance Method Summary collapse
-
#except ⇒ Array of Specification
private
Specifications for excluding source files from being autoloaded.
-
#only ⇒ Array of Specification
private
Specifications for narrowing the set of source files being autoloaded as well as optionally renaming and/or reorganizing their corresponding constants.
-
#validate!(attribute) ⇒ Specifications
private
Evaluates the specifications for conflicts, in reference to the specified attribute.
-
#with ⇒ Array of Specification
private
Specifications for renaming and/or reorganizing the constants corresponding to source files being autoloaded.
Instance Method Details
#except ⇒ Array of Specification
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Specifications for excluding source files from being autoloaded.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/autoloaded/specifications.rb', line 37 [:except, :only, :with].each do |attribute_name| define_method attribute_name do variable_name = "@#{attribute_name}" ((instance_variable_defined?(variable_name) && instance_variable_get(variable_name)) || []).tap do |value| instance_variable_set variable_name, value end end end |
#only ⇒ Array of Specification
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Specifications for narrowing the set of source files being autoloaded as well as optionally renaming and/or reorganizing their corresponding constants.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/autoloaded/specifications.rb', line 37 [:except, :only, :with].each do |attribute_name| define_method attribute_name do variable_name = "@#{attribute_name}" ((instance_variable_defined?(variable_name) && instance_variable_get(variable_name)) || []).tap do |value| instance_variable_set variable_name, value end end end |
#validate!(attribute) ⇒ Specifications
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Evaluates the specifications for conflicts, in reference to the specified attribute.
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/autoloaded/specifications.rb', line 61 def validate!(attribute) other_attribute = {except: :only, only: :except}[attribute] if other_attribute unless send(attribute).empty? || send(other_attribute).empty? raise "can't specify `#{attribute}' when `#{other_attribute}' is " + 'already specified' end end self end |
#with ⇒ Array of Specification
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Specifications for renaming and/or reorganizing the constants corresponding to source files being autoloaded.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/autoloaded/specifications.rb', line 37 [:except, :only, :with].each do |attribute_name| define_method attribute_name do variable_name = "@#{attribute_name}" ((instance_variable_defined?(variable_name) && instance_variable_get(variable_name)) || []).tap do |value| instance_variable_set variable_name, value end end end |