Class: Metadata::Metadatum
- Inherits:
-
Object
- Object
- Metadata::Metadatum
- Defined in:
- lib/i18n/migrations/metadata.rb
Instance Attribute Summary collapse
-
#autotranslated ⇒ Object
Returns the value of attribute autotranslated.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#notes ⇒ Object
Returns the value of attribute notes.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Metadatum
constructor
A new instance of Metadatum.
- #to_h ⇒ Object
Constructor Details
#initialize(hash) ⇒ Metadatum
Returns a new instance of Metadatum.
44 45 46 47 48 49 |
# File 'lib/i18n/migrations/metadata.rb', line 44 def initialize(hash) safe_hash = hash || {} @errors = safe_hash['errors'] || [] @notes = safe_hash['notes'] @autotranslated = !!safe_hash['autotranslated'] end |
Instance Attribute Details
#autotranslated ⇒ Object
Returns the value of attribute autotranslated.
42 43 44 |
# File 'lib/i18n/migrations/metadata.rb', line 42 def autotranslated @autotranslated end |
#errors ⇒ Object
Returns the value of attribute errors.
42 43 44 |
# File 'lib/i18n/migrations/metadata.rb', line 42 def errors @errors end |
#notes ⇒ Object
Returns the value of attribute notes.
42 43 44 |
# File 'lib/i18n/migrations/metadata.rb', line 42 def notes @notes end |
Instance Method Details
#to_h ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/i18n/migrations/metadata.rb', line 51 def to_h hash = {} hash['errors'] = @errors unless @errors.empty? hash['notes'] = @notes unless @notes.blank? hash['autotranslated'] = @autotranslated if autotranslated hash end |