Class: ApkgToCsv::Note
- Inherits:
-
Object
- Object
- ApkgToCsv::Note
- Defined in:
- lib/apkg_to_csv/note.rb
Instance Attribute Summary collapse
-
#model_id ⇒ Object
readonly
Returns the value of attribute model_id.
Class Method Summary collapse
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(model_id, field_string) ⇒ Note
constructor
A new instance of Note.
Constructor Details
#initialize(model_id, field_string) ⇒ Note
Returns a new instance of Note.
11 12 13 14 |
# File 'lib/apkg_to_csv/note.rb', line 11 def initialize(model_id, field_string) @model_id = model_id.to_s @field_string = field_string end |
Instance Attribute Details
#model_id ⇒ Object (readonly)
Returns the value of attribute model_id.
9 10 11 |
# File 'lib/apkg_to_csv/note.rb', line 9 def model_id @model_id end |
Class Method Details
.from_db(db) ⇒ Object
3 4 5 6 7 |
# File 'lib/apkg_to_csv/note.rb', line 3 def self.from_db(db) db.execute('SELECT mid, flds FROM notes').map do |model_id, field_string| new(model_id, field_string) end end |
Instance Method Details
#fields ⇒ Object
16 17 18 |
# File 'lib/apkg_to_csv/note.rb', line 16 def fields @fields ||= field_string.split("\x1f") end |