Class: Prependers::Prepender
- Inherits:
-
Module
- Object
- Module
- Prependers::Prepender
- Defined in:
- lib/prependers/prepender.rb
Constant Summary collapse
- NAMESPACE_DEPRECATION =
"[DEPRECATION] Passing a namespace to `Prependers::Prepender#[]` is deprecated. Use the " \ "`:namespace` option instead."
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #included(base) ⇒ Object
-
#initialize(options_or_namespace = {}) ⇒ Prepender
constructor
A new instance of Prepender.
Constructor Details
#initialize(options_or_namespace = {}) ⇒ Prepender
Returns a new instance of Prepender.
15 16 17 18 19 20 21 22 |
# File 'lib/prependers/prepender.rb', line 15 def initialize( = {}) if .is_a?(Module) warn NAMESPACE_DEPRECATION % { namespace: } = { namespace: } end @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/prependers/prepender.rb', line 9 def @options end |
Class Method Details
.[](options = {}) ⇒ Object
5 6 7 |
# File 'lib/prependers/prepender.rb', line 5 def self.[]( = {}) new() end |
Instance Method Details
#included(base) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/prependers/prepender.rb', line 24 def included(base) if .key?(:namespace) base.include Prependers::Annotate::Namespace.new([:namespace]) end if .key?(:verify) base.include Prependers::Annotate::Verify.new([:verify]) end prependable = Prependers.prependable_for(base) prependable.prepend(base) if base.const_defined?('ClassMethods') prependable.singleton_class.prepend(base.const_get('ClassMethods')) end end |