lib/simplabs/excellent/parsing/class_context.rb in simplabs-excellent-1.5.1 vs lib/simplabs/excellent/parsing/class_context.rb in simplabs-excellent-1.5.2

- old
+ new

@@ -37,10 +37,11 @@ @base_class_name = get_base_class_name @methods = [] @line_count = count_lines @attr_accessible = false @attr_protected = false + @initializer = false @validations = [] end def active_record_model? @base_class_name == 'ActiveRecord::Base' @@ -52,16 +53,25 @@ def specifies_attr_protected? @attr_protected end + def defines_initializer? + @initializer + end + def validating? !@validations.empty? || @methods.any?{ |method| %(validate validate_on_create validate_on_update).include?(method.name) } end def process_call(exp) @attr_accessible = true if exp[2] == :attr_accessible @attr_protected = true if exp[2] == :attr_protected + super + end + + def process_defn(exp) + @initializer = true if exp[2] == :initialize super end private