class Writetheman::Article::Base
Public Class Methods
new(path_application)
click to toggle source
# File lib/writetheman/article/base.rb, line 11 def initialize(path_application) @path_application = path_application @extension = ".html.markdown" end
Public Instance Methods
create()
click to toggle source
# File lib/writetheman/article/base.rb, line 16 def create init_header_from_params if @header.nil? || @header.empty? init_content_from_header_body init_filename if @filename.nil? || @filename.empty? create_file end
create_from_params(params={})
click to toggle source
# File lib/writetheman/article/base.rb, line 23 def create_from_params(params={}) remove_access! init_from_params(params) if !params.empty? create end
load_from_file(filename)
click to toggle source
# File lib/writetheman/article/base.rb, line 37 def load_from_file(filename) remove_access! @filename = filename read #@title = @header_params['title'] #@date = Date.parse(@header_params['date']) init_header_params end
load_from_title(title, date)
click to toggle source
# File lib/writetheman/article/base.rb, line 46 def load_from_title(title, date) remove_access! @title = title @date = date read end
read()
click to toggle source
# File lib/writetheman/article/base.rb, line 29 def read remove_content! init_filename read_file init_header_body_from_content @all_content end
remove_all!()
click to toggle source
# File lib/writetheman/article/base.rb, line 64 def remove_all! remove_access! remove_content! end
update(oldfilename)
click to toggle source
# File lib/writetheman/article/base.rb, line 53 def update(oldfilename) delete_file(oldfilename) create end
update_from_params(oldfilename, params={})
click to toggle source
# File lib/writetheman/article/base.rb, line 58 def update_from_params(oldfilename, params={}) remove_access! init_from_params(params) if !params.empty? update(oldfilename) end