Class: ConfOptions::String

Inherits:
Standard
  • Object
show all
Defined in:
lib/confoptions.rb

Instance Method Summary collapse

Methods inherited from Standard

#initialize, #to_pair, #to_s

Constructor Details

This class inherits a constructor from ConfOptions::Standard

Instance Method Details

#getObject


27
28
29
30
31
32
33
34
35
# File 'lib/confoptions.rb', line 27

def get
    if self[:getter].is_a? Proc
        self[:getter].call self
    elsif self[:env_names].is_a? ::Array and self[:check_regexp].is_a? Regexp
        default_getter
    else
        [ to_pair ].to_h
    end
end

#validate!(context = ConfSources::Default.new) ⇒ Object


23
24
25
26
# File 'lib/confoptions.rb', line 23

def validate! context = ConfSources::Default.new
    self[:validator].call(self,context) if self[:validator].is_a? Proc
    default_validator if self[:check_regexp]
end