Class: AdLint::MessageTraits

Inherits:
Object
  • Object
show all
Includes:
CompoundPathParser, Validation
Defined in:
lib/adlint/traits.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CompoundPathParser

parse_compound_path_list, parse_compound_path_str

Methods included from Validation

#ensure_dir_presence_of, #ensure_dirs_presence_of, #ensure_exam_packages_presence_of, #ensure_file_presence_of, #ensure_inclusion_of, #ensure_numericality_of, #ensure_presence_of, #ensure_true_or_false_of, #ensure_validity_of, #ensure_with, #errors, included, #valid?, #validators

Constructor Details

#initialize(doc) ⇒ MessageTraits

Returns a new instance of MessageTraits.



496
497
498
499
500
501
502
503
504
505
506
# File 'lib/adlint/traits.rb', line 496

def initialize(doc)
  @language               = doc["language"]
  @individual_suppression = doc["individual_suppression"]
  @exclusion              = Exclusion.new(doc["exclusion"])
  @inclusion              = Inclusion.new(doc["inclusion"])

  @change_list =
    (doc["change_list"] || []).each_with_object({}) { |(name, cont), hash|
      hash[MessageId.new(cont["package"], name.to_sym)] = cont
    }
end

Instance Attribute Details

#change_listObject (readonly)

Returns the value of attribute change_list.



524
525
526
# File 'lib/adlint/traits.rb', line 524

def change_list
  @change_list
end

#exclusionObject (readonly)

Returns the value of attribute exclusion.



518
519
520
# File 'lib/adlint/traits.rb', line 518

def exclusion
  @exclusion
end

#inclusionObject (readonly)

Returns the value of attribute inclusion.



521
522
523
# File 'lib/adlint/traits.rb', line 521

def inclusion
  @inclusion
end

#individual_suppressionObject (readonly)

Returns the value of attribute individual_suppression.



515
516
517
# File 'lib/adlint/traits.rb', line 515

def individual_suppression
  @individual_suppression
end

#languageObject (readonly)

Returns the value of attribute language.



512
513
514
# File 'lib/adlint/traits.rb', line 512

def language
  @language
end

Instance Method Details

#entity_nameObject



508
509
510
# File 'lib/adlint/traits.rb', line 508

def entity_name
  "message_traits"
end

#freezeObject



586
587
588
589
590
591
592
593
# File 'lib/adlint/traits.rb', line 586

def freeze
  @language.freeze
  @individual_suppression.freeze
  @exclusion.freeze
  @inclusion.freeze
  @change_list.freeze
  super
end