Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ gem 'base64'
gem 'bigdecimal'
gem 'mutex_m'

if /java/ === RUBY_PLATFORM # JRuby
if /java/.match?(RUBY_PLATFORM) # JRuby
gem 'pandoc-ruby'
else
gem 'redcarpet'
Expand Down
4 changes: 2 additions & 2 deletions lib/haml/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def inspect
DynamicAttributes = Struct.new(:new, :old) do
undef :old=
def old=(value)
unless value =~ /\A{.*}\z/m
unless /\A{.*}\z/m.match?(value)
raise ArgumentError.new('Old attributes must start with "{" and end with "}"')
end
self[:old] = value
Expand Down Expand Up @@ -528,7 +528,7 @@ def doctype(text)
end

def filter(name)
raise Error.new(Error.message(:invalid_filter_name, name)) unless name =~ /^\w+$/
raise Error.new(Error.message(:invalid_filter_name, name)) unless /^\w+$/.match?(name)

if filter_opened?
@flat = true
Expand Down
2 changes: 1 addition & 1 deletion lib/haml/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def check_encoding(str)
# Shortcut for UTF-8 which might be the majority case
if str.encoding == Encoding::UTF_8
return str.gsub(/\A\uFEFF/, '')
elsif str.encoding.name =~ /^UTF-(16|32)(BE|LE)?$/
elsif /^UTF-(16|32)(BE|LE)?$/.match?(str.encoding.name)
return str.gsub(Regexp.new("\\A\uFEFF".encode(str.encoding)), '')
else
return str
Expand Down
2 changes: 1 addition & 1 deletion test/haml/engine/old_attribute_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
end

it 'does not crash when nil is given' do
if /java/ === RUBY_PLATFORM
if /java/.match?(RUBY_PLATFORM)
skip 'maybe due to Ripper of JRuby'
end

Expand Down
2 changes: 1 addition & 1 deletion test/haml/filters/coffee_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@
alert("#{'<&>'}")
HAML
end
end unless /java/ === RUBY_PLATFORM # execjs is not working with Travis JRuby environment
end unless /java/.match?(RUBY_PLATFORM) # execjs is not working with Travis JRuby environment
end
4 changes: 2 additions & 2 deletions test/haml/line_number_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
= __LINE__
HAML
end
end unless /java/ === RUBY_PLATFORM # execjs is not working with Travis JRuby environment
end unless /java/.match?(RUBY_PLATFORM) # execjs is not working with Travis JRuby environment

describe 'css filter' do
it 'renders static filter' do
Expand Down Expand Up @@ -244,7 +244,7 @@
= __LINE__
HAML
end
end unless /java/ === RUBY_PLATFORM # execjs is not working with Travis JRuby environment
end unless /java/.match?(RUBY_PLATFORM) # execjs is not working with Travis JRuby environment

describe 'plain filter' do
it 'renders line numbers with an empty line correctly' do
Expand Down
2 changes: 1 addition & 1 deletion test/haml/string_splitter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def assert_compile(expected, code)
end

it 'raises internal error' do
if /java/ === RUBY_PLATFORM
if /java/.match?(RUBY_PLATFORM)
skip 'Ripper of JRuby is behaving in a different way'
end

Expand Down