Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b8c6a71c4dfc
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6edaa05daadf
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jan 6, 2015

  1. Use case insensitive search when finding Encodings

    Other rubies allow both Encoding.find('binary') and
    Encoding.find('BINARY'). Opal was only allowing the uppercase version.
    This change permits the lowercase search string as well.
    wasnotrice committed Jan 6, 2015
    Copy the full SHA
    299343e View commit details
  2. Merge pull request #682 from wasnotrice/find-encoding-case-insensitive

    Use case insensitive search when finding Encodings
    elia committed Jan 6, 2015
    Copy the full SHA
    6edaa05 View commit details
Showing with 3 additions and 2 deletions.
  1. +3 −2 stdlib/encoding.rb
5 changes: 3 additions & 2 deletions stdlib/encoding.rb
Original file line number Diff line number Diff line change
@@ -12,12 +12,13 @@ def self.register(name, options = {}, &block)
end

def self.find(name)
return name if self === name
upcase_name = name.upcase
return upcase_name if self === upcase_name

constants.each {|const|
encoding = const_get(const)

if encoding.name == name || encoding.names.include?(name)
if encoding.name == upcase_name || encoding.names.include?(upcase_name)
return encoding
end
}