Class: Myun2::TwitterShell::Profile
- Inherits:
-
Object
- Object
- Myun2::TwitterShell::Profile
- Defined in:
- lib/myun2/twitter_shell/profile.rb
Defined Under Namespace
Classes: Loader
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Profile
constructor
A new instance of Profile.
- #profile_path ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Profile
Returns a new instance of Profile.
18 19 20 |
# File 'lib/myun2/twitter_shell/profile.rb', line 18 def initialize(params = {}) @data = params end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/myun2/twitter_shell/profile.rb', line 4 def data @data end |
Class Method Details
.default_profile_path ⇒ Object
41 42 43 |
# File 'lib/myun2/twitter_shell/profile.rb', line 41 def self.default_profile_path File.join(root_dir, 'profile') end |
.load(path = nil) ⇒ Object
32 33 34 35 |
# 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 |
.root_dir ⇒ Object
37 38 39 |
# File 'lib/myun2/twitter_shell/profile.rb', line 37 def self.root_dir File.('~/.twsh') end |
Instance Method Details
#profile_path ⇒ Object
45 46 47 |
# File 'lib/myun2/twitter_shell/profile.rb', line 45 def profile_path @profile_path ||= Profile.default_profile_path end |