class Myun2::TwitterShell::Profile

Attributes

data[R]

Public Class Methods

default_profile_path() click to toggle source
# File lib/myun2/twitter_shell/profile.rb, line 41
def self.default_profile_path
  File.join(root_dir, 'profile')
end
load(path = nil) click to toggle source
# File lib/myun2/twitter_shell/profile.rb, line 32
def self.load(path = nil)
  return unless data = Loader.load(path || default_profile_path)
  new(data)
end
new(params = {}) click to toggle source
# File lib/myun2/twitter_shell/profile.rb, line 18
def initialize(params = {})
  @data = params
end
root_dir() click to toggle source
# File lib/myun2/twitter_shell/profile.rb, line 37
def self.root_dir
  File.expand_path('~/.twsh')
end

Public Instance Methods

profile_path() click to toggle source
# File lib/myun2/twitter_shell/profile.rb, line 45
def profile_path
  @profile_path ||= Profile.default_profile_path
end
save() click to toggle source
# File lib/myun2/twitter_shell/profile.rb, line 22
def save
  Dir.mkdir Profile.root_dir unless File.exist?(Profile.root_dir)

  open(profile_path, "w") do |f|
    @data.each do |key,value|
      f.puts key.to_s + "=" + value.to_s
    end
  end
end