Module: RailsBestPractices::Core::Check::Moduleable
- Included in:
- Prepares::HelperPrepare
- Defined in:
- lib/rails_best_practices/core/check.rb
Overview
Helper to parse the module name.
Class Method Summary collapse
Instance Method Summary collapse
-
#current_module_name ⇒ Object
get the current module name.
-
#moduleable_modules ⇒ Object
modules.
Class Method Details
.included(base) ⇒ Object
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/rails_best_practices/core/check.rb', line 218 def self.included(base) base.class_eval do interesting_nodes :module # remember module name add_callback "start_module" do |node| moduleable_modules << node.module_name.to_s end # end of module add_callback "end_module" do |node| moduleable_modules.pop end end end |
Instance Method Details
#current_module_name ⇒ Object
get the current module name.
235 236 237 |
# File 'lib/rails_best_practices/core/check.rb', line 235 def current_module_name moduleable_modules.join("::") end |
#moduleable_modules ⇒ Object
modules.
240 241 242 |
# File 'lib/rails_best_practices/core/check.rb', line 240 def moduleable_modules @moduleable_moduels ||= [] end |