Class: ConfOptions::String
Instance Method Summary collapse
- #get ⇒ Object
-
#validate!(context = ConfSources::Default.new) ⇒ Object
Validate :value by :validator Proc + default validator for String.
Methods inherited from Standard
Constructor Details
This class inherits a constructor from ConfOptions::Standard
Instance Method Details
#get ⇒ Object
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 |