Class: AnnotateModel::AnnotationDecider

Inherits:
Object
  • Object
show all
Defined in:
lib/annotate_model/annotation_decider.rb

Constant Summary collapse

SKIP_FLAG =
"# == annotate_model:skip"

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ AnnotationDecider

Returns a new instance of AnnotationDecider.



7
8
9
# File 'lib/annotate_model/annotation_decider.rb', line 7

def initialize(file)
  @file = file
end

Instance Method Details

#annotate?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/annotate_model/annotation_decider.rb', line 11

def annotate?
  return false if skip_flag_present?

  begin
    klass = @file.model_name.constantize
  rescue NameError
    return false
  end

  annotate_conditions(klass).all?
end