Class: FrenchPress

Inherits:
Object
  • Object
show all
Defined in:
lib/frenchpress.rb,
lib/frenchpress/cmd.rb,
lib/frenchpress/blog.rb,
lib/frenchpress/post.rb,
lib/frenchpress/post/code.rb,
lib/frenchpress/post/link.rb,
lib/frenchpress/post/image.rb,
lib/frenchpress/post/generic.rb,
lib/frenchpress/post/spotify.rb,
lib/frenchpress/post/youtube.rb,
lib/frenchpress/post/markdown.rb

Overview

The FrenchPress class houses some conveience methods for accessing a Blog object, as well as misc properties (such as self.version) and settings manipulation (such as self.default=)

Defined Under Namespace

Classes: Blog, CMD, Post

Class Method Summary collapse

Class Method Details

.default=(default_dir) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/frenchpress.rb', line 23

def self.default=(default_dir)
  Dir.chdir(Dir.home) do
    File.open('.frenchpress_dir', 'w+') do |f|
      f.truncate 0
      f.write default_dir
    end
  end
end

.open(dir) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/frenchpress.rb', line 10

def self.open(dir)
  default_file = File.join Dir.home, '.frenchpress_dir'
  dir ||= File.open(default_file).read.to_s if File.exist?(default_file)
  dir ||= Dir.getwd
  dir = File.expand_path(dir)
  FrenchPress.working = FrenchPress::Blog.new dir # sets a class inst var
  FrenchPress.working
end

.versionObject



19
20
21
# File 'lib/frenchpress.rb', line 19

def self.version
  '0.1.0'
end

.workingObject



32
33
34
# File 'lib/frenchpress.rb', line 32

def self.working
  @working
end

.working=(blag) ⇒ Object



36
37
38
# File 'lib/frenchpress.rb', line 36

def self.working=(blag)
  @working = blag
end