Skip to content

Commit

Permalink
Rename Figaro::Config's internal @variable_methods to @accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
laserlemon committed Nov 21, 2017
1 parent 6baee3a commit db546f1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/figaro/config.rb
Expand Up @@ -36,9 +36,9 @@ def initialize
@envfile_content = @envfile_path.read
@defaults = {}
@variables = []
@variable_methods = ::Module.new
@accessors = ::Module.new

extend @variable_methods
extend @accessors
end

def load
Expand All @@ -63,7 +63,7 @@ def load_defaults(path)

def <<(variable)
@variables << variable
add_variable_methods(variable)
add_accessors(variable)
end

def get(key, &default)
Expand All @@ -90,8 +90,8 @@ def to_h

private

def add_variable_methods(variable)
@variable_methods.instance_eval do
def add_accessors(variable)
@accessors.instance_eval do
define_method(variable.name, &variable.method(:value))
define_method(:"#{variable.name}=", &variable.method(:value=))
define_method(:"#{variable.name}?", &variable.method(:value?))
Expand Down

0 comments on commit db546f1

Please sign in to comment.