Class: Hobix::Config
- Inherits:
-
Object
- Object
- Hobix::Config
- Defined in:
- lib/hobix/config.rb
Instance Attribute Summary collapse
-
#personal ⇒ Object
Returns the value of attribute personal.
-
#post_upgen ⇒ Object
Returns the value of attribute post_upgen.
-
#use_editor ⇒ Object
Returns the value of attribute use_editor.
-
#username ⇒ Object
Returns the value of attribute username.
-
#weblogs ⇒ Object
Returns the value of attribute weblogs.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
23 24 25 26 |
# File 'lib/hobix/config.rb', line 23 def initialize @username = ENV['USER'] unless @username self end |
Instance Attribute Details
#personal ⇒ Object
Returns the value of attribute personal.
21 22 23 |
# File 'lib/hobix/config.rb', line 21 def personal @personal end |
#post_upgen ⇒ Object
Returns the value of attribute post_upgen.
21 22 23 |
# File 'lib/hobix/config.rb', line 21 def post_upgen @post_upgen end |
#use_editor ⇒ Object
Returns the value of attribute use_editor.
21 22 23 |
# File 'lib/hobix/config.rb', line 21 def use_editor @use_editor end |
#username ⇒ Object
Returns the value of attribute username.
21 22 23 |
# File 'lib/hobix/config.rb', line 21 def username @username end |
#weblogs ⇒ Object
Returns the value of attribute weblogs.
21 22 23 |
# File 'lib/hobix/config.rb', line 21 def weblogs @weblogs end |
Class Method Details
.load(conf_file) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hobix/config.rb', line 27 def Config.load( conf_file ) c = YAML::load( File::open( conf_file ) ) c.keys.each do |k| if k =~ /\s/ k_ = k.gsub( /\s/, '_' ) c[k_] = c.delete( k ) end end c = YAML::object_maker( Hobix::Config, c ) c.initialize end |