Class: Hutils::Ltap::Conf
- Inherits:
-
Object
- Object
- Hutils::Ltap::Conf
- Defined in:
- lib/hutils/ltap/conf.rb
Defined Under Namespace
Classes: SectionNotFound
Instance Attribute Summary collapse
-
#earliest ⇒ Object
Returns the value of attribute earliest.
-
#key ⇒ Object
Returns the value of attribute key.
-
#profile ⇒ Object
Returns the value of attribute profile.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#timestamps ⇒ Object
Returns the value of attribute timestamps.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize ⇒ Conf
constructor
A new instance of Conf.
- #load ⇒ Object
- #load_section(name) ⇒ Object
Constructor Details
#initialize ⇒ Conf
Returns a new instance of Conf.
14 15 16 17 18 19 20 |
# File 'lib/hutils/ltap/conf.rb', line 14 def initialize @ini = IniFile.load(ENV["HOME"] + "/.ltap") self.earliest = "-24h" self.timeout = 60 self. = false self.verbose = false end |
Instance Attribute Details
#earliest ⇒ Object
Returns the value of attribute earliest.
5 6 7 |
# File 'lib/hutils/ltap/conf.rb', line 5 def earliest @earliest end |
#key ⇒ Object
Returns the value of attribute key.
6 7 8 |
# File 'lib/hutils/ltap/conf.rb', line 6 def key @key end |
#profile ⇒ Object
Returns the value of attribute profile.
7 8 9 |
# File 'lib/hutils/ltap/conf.rb', line 7 def profile @profile end |
#timeout ⇒ Object
Returns the value of attribute timeout.
8 9 10 |
# File 'lib/hutils/ltap/conf.rb', line 8 def timeout @timeout end |
#timestamps ⇒ Object
Returns the value of attribute timestamps.
9 10 11 |
# File 'lib/hutils/ltap/conf.rb', line 9 def @timestamps end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/hutils/ltap/conf.rb', line 10 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'lib/hutils/ltap/conf.rb', line 11 def url @url end |
#verbose ⇒ Object
Returns the value of attribute verbose.
12 13 14 |
# File 'lib/hutils/ltap/conf.rb', line 12 def verbose @verbose end |
Instance Method Details
#load ⇒ Object
22 23 24 |
# File 'lib/hutils/ltap/conf.rb', line 22 def load load_section("global") end |
#load_section(name) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/hutils/ltap/conf.rb', line 26 def load_section(name) return unless @ini raise SectionNotFound unless @ini.has_section?(name) section = @ini[name] load_value(section, :earliest) load_value(section, :key) load_value(section, :profile) load_value(section, :timeout) load_value(section, :timestamps) load_value(section, :type) load_value(section, :url) load_value(section, :verbose) end |