Class: MixinComment::Part

Inherits:
Object
  • Object
show all
Defined in:
lib/mixin_comment/part.rb

Constant Summary collapse

LABELS =
[
  'required methods',
  'required class methods',
  'required override methods',
  'required columns',
  'required associations'
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(module_name, label, attributes) ⇒ Part

Returns a new instance of Part.



16
17
18
19
20
21
# File 'lib/mixin_comment/part.rb', line 16

def initialize(module_name, label, attributes)
  @module_name = module_name
  @label = label
  @attributes = attributes
  @errors = []
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



13
14
15
# File 'lib/mixin_comment/part.rb', line 13

def attributes
  @attributes
end

#errorsObject

Returns the value of attribute errors.



14
15
16
# File 'lib/mixin_comment/part.rb', line 14

def errors
  @errors
end

#labelObject

Returns the value of attribute label.



13
14
15
# File 'lib/mixin_comment/part.rb', line 13

def label
  @label
end

#module_nameObject

Returns the value of attribute module_name.



13
14
15
# File 'lib/mixin_comment/part.rb', line 13

def module_name
  @module_name
end

Instance Method Details

#has_errors?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/mixin_comment/part.rb', line 23

def has_errors?
  @errors.present?
end

#show_errorsObject



27
28
29
30
31
# File 'lib/mixin_comment/part.rb', line 27

def show_errors
  errors.each do |klass, attr|
    puts "#{klass}##{attr} is #{label.singularize} by #{module_name}"
  end
end