class Grandfather::Md

Class load files and determine if valid

Attributes

data[R]
filename[R]
name[R]

Public Class Methods

new(filename) click to toggle source
# File lib/grandfather/md.rb, line 9
def initialize(filename)
  @filename = filename
  @extension = ::File.extname(@filename)
  @name = ::File.basename(@filename, @extension)
  @data = ::File.open(@filename, 'rb' ) { |f| f.read } if ::File.exists?(@filename)
end

Public Instance Methods

valid?() click to toggle source
# File lib/grandfather/md.rb, line 16
def valid?
  valid_format? @extension
end
valid_format?(format) click to toggle source
# File lib/grandfather/md.rb, line 20
def valid_format?(format)
  # All the files are missing extensions, if it has an extension it is wrong
    # kinda hacky not happy with it
  format.empty?
  #return false if format.nil?

  #format.to_sym == :md
end