lib/skeptic/rules/methods_per_class.rb in skeptic-0.0.3 vs lib/skeptic/rules/methods_per_class.rb in skeptic-0.0.4
- old
+ new
@@ -44,9 +44,21 @@
visit params
visit body
end
+ on :defs do |target, _, name, params, body|
+ target_name = extract_name(target)
+ method_name = extract_name(name)
+ class_name = env[:class]
+
+ target_name = class_name if target_name == "self"
+ @methods[target_name] << method_name
+
+ visit params
+ visit body
+ end
+
on :class do |name, parents, body|
env.push :class => qualified_class_name(name)
visit parents if parents
visit body