Class: Monotes::BodyText

Inherits:
Object
  • Object
show all
Includes:
AppDirectory
Defined in:
lib/monotes/body_text.rb

Constant Summary collapse

FILENAME =
"ISSUE_BODY_TEXT"

Instance Method Summary collapse

Methods included from AppDirectory

#app_path

Constructor Details

#initialize(title) ⇒ BodyText

Returns a new instance of BodyText.



8
9
10
# File 'lib/monotes/body_text.rb', line 8

def initialize(title)
  @title = title
end

Instance Method Details

#create_issueObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/monotes/body_text.rb', line 20

def create_issue
  edit_success = system "vim #{path}"
  if edit_success
    body_text = read
    flush
    Monotes::Models::Issue.new(:title => @title, :body => body_text)
  else
    nil
  end
end

#flushObject



16
17
18
# File 'lib/monotes/body_text.rb', line 16

def flush
  File.delete(path)
end

#readObject



12
13
14
# File 'lib/monotes/body_text.rb', line 12

def read
  File.read(path)
end