Class: Charyf::Configuration::Generators
- Defined in:
- lib/charyf/utils/configuration.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#hidden_namespaces ⇒ Object
readonly
Returns the value of attribute hidden_namespaces.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #hide_namespace(namespace) ⇒ Object
-
#initialize ⇒ Generators
constructor
A new instance of Generators.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize ⇒ Generators
Returns a new instance of Generators.
8 9 10 11 |
# File 'lib/charyf/utils/configuration.rb', line 8 def initialize @hidden_namespaces = [] = Hash.new { |h, k| h[k] = {} } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/charyf/utils/configuration.rb', line 17 def method_missing(method, *args) method = method.to_s.sub(/=$/, "").to_sym return [method] if args.empty? if method == :charyf || args.first.is_a?(Hash) namespace, configuration = method, args.shift else namespace, configuration = args.shift, args.shift namespace = namespace.to_sym if namespace.respond_to?(:to_sym) [:charyf][method] = namespace end if configuration [namespace].merge!(configuration) end end |
Instance Attribute Details
#hidden_namespaces ⇒ Object (readonly)
Returns the value of attribute hidden_namespaces.
6 7 8 |
# File 'lib/charyf/utils/configuration.rb', line 6 def hidden_namespaces @hidden_namespaces end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/charyf/utils/configuration.rb', line 5 def end |
Instance Method Details
#hide_namespace(namespace) ⇒ Object
13 14 15 |
# File 'lib/charyf/utils/configuration.rb', line 13 def hide_namespace(namespace) @hidden_namespaces << namespace end |