mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Rename Util#inspect -> #inspect_obj.
Overriding #inspect made debugging hard.
This commit is contained in:
parent
8e9a8301ca
commit
43b4e23c03
2 changed files with 10 additions and 10 deletions
|
@ -118,8 +118,8 @@ END
|
||||||
|
|
||||||
names.map do |name|
|
names.map do |name|
|
||||||
# Can't use || because someone might explicitly pass in false with a symbol
|
# Can't use || because someone might explicitly pass in false with a symbol
|
||||||
sym_local = "_haml_locals[#{inspect(name.to_sym)}]"
|
sym_local = "_haml_locals[#{inspect_obj(name.to_sym)}]"
|
||||||
str_local = "_haml_locals[#{inspect(name.to_s)}]"
|
str_local = "_haml_locals[#{inspect_obj(name.to_s)}]"
|
||||||
"#{name} = #{sym_local}.nil? ? #{str_local} : #{sym_local}"
|
"#{name} = #{sym_local}.nil? ? #{str_local} : #{sym_local}"
|
||||||
end.join(';') + ';'
|
end.join(';') + ';'
|
||||||
end
|
end
|
||||||
|
@ -320,7 +320,7 @@ END
|
||||||
@to_merge.each do |type, val, tabs|
|
@to_merge.each do |type, val, tabs|
|
||||||
case type
|
case type
|
||||||
when :text
|
when :text
|
||||||
str << inspect(val)[1...-1]
|
str << inspect_obj(val)[1...-1]
|
||||||
mtabs += tabs
|
mtabs += tabs
|
||||||
when :script
|
when :script
|
||||||
if mtabs != 0 && !@options[:ugly]
|
if mtabs != 0 && !@options[:ugly]
|
||||||
|
@ -662,7 +662,7 @@ END
|
||||||
if type == :static
|
if type == :static
|
||||||
static_attributes[name] = val
|
static_attributes[name] = val
|
||||||
else
|
else
|
||||||
dynamic_attributes << inspect(name) << " => " << val << ","
|
dynamic_attributes << inspect_obj(name) << " => " << val << ","
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
dynamic_attributes << "}"
|
dynamic_attributes << "}"
|
||||||
|
@ -697,7 +697,7 @@ END
|
||||||
|
|
||||||
return name, [:static, content.first[1]] if content.size == 1
|
return name, [:static, content.first[1]] if content.size == 1
|
||||||
return name, [:dynamic,
|
return name, [:dynamic,
|
||||||
'"' + content.map {|(t, v)| t == :str ? inspect(v)[1...-1] : "\#{#{v}}"}.join + '"']
|
'"' + content.map {|(t, v)| t == :str ? inspect_obj(v)[1...-1] : "\#{#{v}}"}.join + '"']
|
||||||
end
|
end
|
||||||
|
|
||||||
# Parses a line that will render as an XHTML tag, and adds the code that will
|
# Parses a line that will render as an XHTML tag, and adds the code that will
|
||||||
|
@ -802,7 +802,7 @@ END
|
||||||
return if tag_closed
|
return if tag_closed
|
||||||
else
|
else
|
||||||
flush_merged_text
|
flush_merged_text
|
||||||
content = parse ? 'nil' : inspect(value)
|
content = parse ? 'nil' : inspect_obj(value)
|
||||||
if attributes_hashes.empty?
|
if attributes_hashes.empty?
|
||||||
attributes_hashes = ''
|
attributes_hashes = ''
|
||||||
elsif attributes_hashes.size == 1
|
elsif attributes_hashes.size == 1
|
||||||
|
@ -813,7 +813,7 @@ END
|
||||||
|
|
||||||
args = [tag_name, self_closing, !block_opened?, preserve_tag, escape_html,
|
args = [tag_name, self_closing, !block_opened?, preserve_tag, escape_html,
|
||||||
attributes, nuke_outer_whitespace, nuke_inner_whitespace
|
attributes, nuke_outer_whitespace, nuke_inner_whitespace
|
||||||
].map {|v| inspect(v)}.join(', ')
|
].map {|v| inspect_obj(v)}.join(', ')
|
||||||
push_silent "_hamlout.open_tag(#{args}, #{object_ref}, #{content}#{attributes_hashes})"
|
push_silent "_hamlout.open_tag(#{args}, #{object_ref}, #{content}#{attributes_hashes})"
|
||||||
@dont_tab_up_next_text = @dont_indent_next_line = dont_indent_next_line
|
@dont_tab_up_next_text = @dont_indent_next_line = dont_indent_next_line
|
||||||
end
|
end
|
||||||
|
@ -1019,7 +1019,7 @@ END
|
||||||
|
|
||||||
def unescape_interpolation(str, opts = {})
|
def unescape_interpolation(str, opts = {})
|
||||||
res = ''
|
res = ''
|
||||||
rest = Haml::Shared.handle_interpolation inspect(str) do |scan|
|
rest = Haml::Shared.handle_interpolation inspect_obj(str) do |scan|
|
||||||
escapes = (scan[2].size - 1) / 2
|
escapes = (scan[2].size - 1) / 2
|
||||||
res << scan.matched[0...-3 - escapes]
|
res << scan.matched[0...-3 - escapes]
|
||||||
if escapes % 2 == 1
|
if escapes % 2 == 1
|
||||||
|
|
|
@ -662,9 +662,9 @@ MSG
|
||||||
#
|
#
|
||||||
# @param obj {Object}
|
# @param obj {Object}
|
||||||
# @return {String}
|
# @return {String}
|
||||||
def inspect(obj)
|
def inspect_obj(obj)
|
||||||
return obj.inspect unless version_geq(::RUBY_VERSION, "1.9.2")
|
return obj.inspect unless version_geq(::RUBY_VERSION, "1.9.2")
|
||||||
return ':' + inspect(obj.to_s) if obj.is_a?(Symbol)
|
return ':' + inspect_obj(obj.to_s) if obj.is_a?(Symbol)
|
||||||
return obj.inspect unless obj.is_a?(String)
|
return obj.inspect unless obj.is_a?(String)
|
||||||
'"' + obj.gsub(/[\x00-\x7F]+/) {|s| s.inspect[1...-1]} + '"'
|
'"' + obj.gsub(/[\x00-\x7F]+/) {|s| s.inspect[1...-1]} + '"'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue