mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
Remove unreachable code re: syck
In ruby >= 2.1, the removed code was no longer reachable, because `YAML::ENGINE.yamler` is always psych, never syck.
This commit is contained in:
parent
7a3b3aa007
commit
6d7b93ff49
1 changed files with 2 additions and 25 deletions
|
@ -24,33 +24,10 @@ module PaperTrail
|
|||
# value in the serialized `object_changes`.
|
||||
def where_object_changes_condition(arel_field, field, value)
|
||||
# Need to check first (before) and secondary (after) fields
|
||||
m1 = nil
|
||||
m2 = nil
|
||||
case yaml_engine_id
|
||||
when :psych
|
||||
m1 = "%\n#{field}:\n- #{value}\n%"
|
||||
m2 = "%\n#{field}:\n-%\n- #{value}\n%"
|
||||
when :syck
|
||||
# Syck adds extra spaces into array dumps
|
||||
m1 = "%\n#{field}: \n%- #{value}\n%"
|
||||
m2 = "%\n#{field}: \n-%\n- #{value}\n%"
|
||||
else
|
||||
raise "Unknown yaml engine"
|
||||
end
|
||||
m1 = "%\n#{field}:\n- #{value}\n%"
|
||||
m2 = "%\n#{field}:\n-%\n- #{value}\n%"
|
||||
arel_field.matches(m1).or(arel_field.matches(m2))
|
||||
end
|
||||
|
||||
# Returns a symbol identifying the YAML engine. Syck was removed from
|
||||
# the ruby stdlib in ruby 2.0, but is still available as a gem.
|
||||
# @api private
|
||||
def yaml_engine_id
|
||||
if (defined?(::YAML::ENGINE) && ::YAML::ENGINE.yamler == "psych") ||
|
||||
(defined?(::Psych) && ::YAML == ::Psych)
|
||||
:psych
|
||||
else
|
||||
:syck
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue