lib/neo4j/active_rel/query.rb in neo4j-3.0.0.rc.5 vs lib/neo4j/active_rel/query.rb in neo4j-3.0.0
- old
+ new
@@ -52,34 +52,33 @@
identifier = '(n1'
identifier + (_from_class == :any ? ')' : cypher_label(:outbound))
when :inbound
identifier = '(n2'
identifier + (_to_class == :any ? ')' : cypher_label(:inbound))
- end
+ end
end
def cypher_label(dir = :outbound)
target_class = dir == :outbound ? as_constant(_from_class) : as_constant(_to_class)
":`#{target_class.mapped_label_name}`)"
end
def as_constant(given_class)
- case
- when given_class.is_a?(String)
+ case given_class
+ when String
given_class.constantize
- when given_class.is_a?(Symbol)
+ when Symbol
given_class.to_s.constantize
else
given_class
end
end
def where_string(args)
- if args.is_a?(Hash)
- args.map do |k, v|
- v.is_a?(Integer) ? "r1.#{k} = #{v}" : "r1.#{k} = '#{v}'"
- end.join(', ')
- else
+ case args
+ when Hash
+ args.map { |k, v| v.is_a?(Integer) ? "r1.#{k} = #{v}" : "r1.#{k} = '#{v}'" }.join(', ')
+ else
args
end
end
end
\ No newline at end of file