class ConfigvarsRails::Descriptor
Configuration variable descriptor.
Attributes
value_type[R]
The type of values that the variable takes.
Public Class Methods
new(value_type, default_value)
click to toggle source
Creates a new variable descriptor.
Args:
type:: the type of values the variable can take default_value:: a Proc or default value for the configuration variable
# File lib/configvars_rails/descriptor.rb, line 12 def initialize(value_type, default_value) @value_type = value_type.to_sym @default = default_value.dup end
Public Instance Methods
default_value()
click to toggle source
The default value to be used if the variable doesn’t have an explicit value.
# File lib/configvars_rails/descriptor.rb, line 19 def default_value if @default.kind_of? Proc @default.call else @default.dup end end