Skip to content

Commit

Permalink
Rework huginn#770 to properly fix huginn#749
Browse files Browse the repository at this point in the history
The receiver for the const_defined?() was incorrect, and modifying the
whole line would render the definition of a constant *::Drop to be
omitted when *Drop was already defined.
  • Loading branch information
knu committed Apr 24, 2015
1 parent 55cb1d0 commit cfe8482
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/concerns/liquid_droppable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ def each
end

included do
const_set :Drop, Kernel.const_set("#{name}Drop", Class.new(Drop)) unless const_defined?("#{name}Drop")
const_set :Drop,
if Kernel.const_defined?(drop_name = "#{name}Drop")
Kernel.const_get(drop_name)
else
Kernel.const_set(drop_name, Class.new(Drop))
end
end

def to_liquid
Expand Down

0 comments on commit cfe8482

Please sign in to comment.