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



39
40
41
42
43
44
45
46
47
# File 'lib/confoptions.rb', line 39

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
        fallback_getter
    end
end

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

Validate :value by :validator Proc + default validator for String



35
36
37
38
# File 'lib/confoptions.rb', line 35

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