Class: Ever2boost::Note
- Inherits:
-
Object
- Object
- Ever2boost::Note
- Defined in:
- lib/ever2boost/note.rb
Constant Summary collapse
- DEFAULT_BYTES_NUMBER =
10
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#notebook_guid ⇒ Object
Returns the value of attribute notebook_guid.
-
#output_dir ⇒ Object
Returns the value of attribute output_dir.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #build_image_link(content_str) ⇒ Object
-
#initialize(title: nil, content: nil, notebook_guid: nil, output_dir: nil) ⇒ Note
constructor
A new instance of Note.
- #md_content ⇒ Object
Constructor Details
#initialize(title: nil, content: nil, notebook_guid: nil, output_dir: nil) ⇒ Note
Returns a new instance of Note.
7 8 9 10 11 12 13 |
# File 'lib/ever2boost/note.rb', line 7 def initialize(title: nil, content: nil, notebook_guid: nil, output_dir: nil) @title = title @content = MdConverter.convert(content) @notebook_guid = notebook_guid @file_name = SecureRandom.hex(DEFAULT_BYTES_NUMBER) @output_dir = output_dir end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
6 7 8 |
# File 'lib/ever2boost/note.rb', line 6 def content @content end |
#file_name ⇒ Object
Returns the value of attribute file_name.
6 7 8 |
# File 'lib/ever2boost/note.rb', line 6 def file_name @file_name end |
#hash ⇒ Object
Returns the value of attribute hash.
6 7 8 |
# File 'lib/ever2boost/note.rb', line 6 def hash @hash end |
#notebook_guid ⇒ Object
Returns the value of attribute notebook_guid.
6 7 8 |
# File 'lib/ever2boost/note.rb', line 6 def notebook_guid @notebook_guid end |
#output_dir ⇒ Object
Returns the value of attribute output_dir.
6 7 8 |
# File 'lib/ever2boost/note.rb', line 6 def output_dir @output_dir end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/ever2boost/note.rb', line 6 def title @title end |
Instance Method Details
#build_image_link(content_str) ⇒ Object
19 20 21 |
# File 'lib/ever2boost/note.rb', line 19 def build_image_link(content_str) content_str.gsub(/<en-media\ hash=['|"](.+?)['|"](.*?).\ type=.(.+?)\/(.+?)['|"](.*?)\/>/, "") end |
#md_content ⇒ Object
15 16 17 |
# File 'lib/ever2boost/note.rb', line 15 def md_content build_image_link(self.content) end |