Class: RgGen::Core::Builder::Layer
- Defined in:
- lib/rggen/core/builder/layer.rb
Defined Under Namespace
Classes: Proxy
Instance Method Summary collapse
- #add_feature_registry(name, registry) ⇒ Object
- #component_defined?(component_name) ⇒ Boolean
- #define_feature(feature_names, &body) ⇒ Object
- #define_list_feature(list_names, &body) ⇒ Object
- #define_list_item_feature(list_name, feature_names, &body) ⇒ Object
- #define_simple_feature(feature_names, &body) ⇒ Object
- #delete ⇒ Object
- #delete_all ⇒ Object
- #enable ⇒ Object
- #enable_all ⇒ Object
-
#initialize(name) ⇒ Layer
constructor
A new instance of Layer.
- #modify_feature(feature_names, &body) ⇒ Object
- #modify_list_feature(list_names, &body) ⇒ Object
- #modify_list_item_feature(list_name, feature_names, &body) ⇒ Object
- #modify_simple_feature(feature_names, &body) ⇒ Object
- #shared_context(&body) ⇒ Object
Constructor Details
#initialize(name) ⇒ Layer
Returns a new instance of Layer.
32 33 34 35 |
# File 'lib/rggen/core/builder/layer.rb', line 32 def initialize(name) @name = name @feature_registries = {} end |
Instance Method Details
#add_feature_registry(name, registry) ⇒ Object
37 38 39 40 |
# File 'lib/rggen/core/builder/layer.rb', line 37 def add_feature_registry(name, registry) @feature_registries[name] = registry define_proxy_call(name) end |
#component_defined?(component_name) ⇒ Boolean
53 54 55 |
# File 'lib/rggen/core/builder/layer.rb', line 53 def component_defined?(component_name) @feature_registries.key?(component_name) end |
#define_feature(feature_names, &body) ⇒ Object
57 58 59 60 61 |
# File 'lib/rggen/core/builder/layer.rb', line 57 def define_feature(feature_names, &body) Array(feature_names).each do |feature_name| do_proxy_call(__method__, nil, feature_name, &body) end end |
#define_list_feature(list_names, &body) ⇒ Object
81 82 83 84 85 |
# File 'lib/rggen/core/builder/layer.rb', line 81 def define_list_feature(list_names, &body) Array(list_names).each do |list_name| do_proxy_call(__method__, list_name, nil, &body) end end |
#define_list_item_feature(list_name, feature_names, &body) ⇒ Object
93 94 95 96 97 |
# File 'lib/rggen/core/builder/layer.rb', line 93 def define_list_item_feature(list_name, feature_names, &body) Array(feature_names).each do |feature_name| do_proxy_call(__method__, list_name, feature_name, &body) end end |
#define_simple_feature(feature_names, &body) ⇒ Object
69 70 71 72 73 |
# File 'lib/rggen/core/builder/layer.rb', line 69 def define_simple_feature(feature_names, &body) Array(feature_names).each do |feature_name| do_proxy_call(__method__, nil, feature_name, &body) end end |
#delete ⇒ Object
115 116 117 118 119 |
# File 'lib/rggen/core/builder/layer.rb', line 115 def delete(...) @feature_registries.each_value do |registry| registry.delete(...) end end |
#delete_all ⇒ Object
121 122 123 |
# File 'lib/rggen/core/builder/layer.rb', line 121 def delete_all @feature_registries.each_value(&:delete_all) end |
#enable ⇒ Object
105 106 107 108 109 |
# File 'lib/rggen/core/builder/layer.rb', line 105 def enable(...) @feature_registries.each_value do |registry| registry.enable(...) end end |
#enable_all ⇒ Object
111 112 113 |
# File 'lib/rggen/core/builder/layer.rb', line 111 def enable_all @feature_registries.each_value(&:enable_all) end |
#modify_feature(feature_names, &body) ⇒ Object
63 64 65 66 67 |
# File 'lib/rggen/core/builder/layer.rb', line 63 def modify_feature(feature_names, &body) Array(feature_names).each do |feature_name| do_proxy_call(__method__, nil, feature_name, &body) end end |
#modify_list_feature(list_names, &body) ⇒ Object
87 88 89 90 91 |
# File 'lib/rggen/core/builder/layer.rb', line 87 def modify_list_feature(list_names, &body) Array(list_names).each do |list_name| do_proxy_call(__method__, list_name, nil, &body) end end |
#modify_list_item_feature(list_name, feature_names, &body) ⇒ Object
99 100 101 102 103 |
# File 'lib/rggen/core/builder/layer.rb', line 99 def modify_list_item_feature(list_name, feature_names, &body) Array(feature_names).each do |feature_name| do_proxy_call(__method__, list_name, feature_name, &body) end end |
#modify_simple_feature(feature_names, &body) ⇒ Object
75 76 77 78 79 |
# File 'lib/rggen/core/builder/layer.rb', line 75 def modify_simple_feature(feature_names, &body) Array(feature_names).each do |feature_name| do_proxy_call(__method__, nil, feature_name, &body) end end |
#shared_context(&body) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rggen/core/builder/layer.rb', line 42 def shared_context(&body) return unless @proxy if block_given? context = current_shared_context(true) context.singleton_exec(&body) end current_shared_context(false) end |