Class: Hobix::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/hobix/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

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

#personalObject

Returns the value of attribute personal.



21
22
23
# File 'lib/hobix/config.rb', line 21

def personal
  @personal
end

#post_upgenObject

Returns the value of attribute post_upgen.



21
22
23
# File 'lib/hobix/config.rb', line 21

def post_upgen
  @post_upgen
end

#use_editorObject

Returns the value of attribute use_editor.



21
22
23
# File 'lib/hobix/config.rb', line 21

def use_editor
  @use_editor
end

#usernameObject

Returns the value of attribute username.



21
22
23
# File 'lib/hobix/config.rb', line 21

def username
  @username
end

#weblogsObject

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