Skip to content

Commit

Permalink
Remove AST structure
Browse files Browse the repository at this point in the history
We ended not using merge as a command since we need to format the key
and ignore the values, removing the benefits of AST.
  • Loading branch information
sobrinho committed Nov 28, 2017
1 parent db6c538 commit 8e4d0bf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/abstract_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def cache_store!(cache_store)
end

def set!(key, value)
@stack << [:set, key, value]
@stack << [key, value]
end

def merge!(value)
Expand Down Expand Up @@ -83,14 +83,9 @@ def cache!(key, options = nil, &block)
def data!
data = {}

@stack.each do |(command, key, value)|
case command
when :set
key = _format_key(key)
data[key] = value unless _ignore_value?(value)
else
raise ArgumentError, "Unexpected command: #{command.inspect}"
end
@stack.each do |(key, value)|
key = _format_key(key)
data[key] = value unless _ignore_value?(value)
end

data
Expand Down

0 comments on commit 8e4d0bf

Please sign in to comment.