INNER CODE UNIT · Ruby
identify
noraj/haiti · lib/haiti.rb:79
def identify(hash)
res = []
PROTOTYPES.each do |prototype|
reg = Regexp.new prototype['regex'], Regexp::IGNORECASE
next unless reg.match?(hash)
prototype['modes'].each do |mode|
res << Chf.new(mode)
end
end
return res
end
# Sort common hash types first
def sort_commons
@type.sort_by! { |e| COMMONS.include?(e.name) ? 0 : 1 }
end
end