lib/classy_enum/collection.rb
# Finds an enum instance by symbol, string, or block.
#
# If a block is given, it passes each entry in enum to block, and returns
# the first enum for which block is not false. If no enum matches, it
# returns nil.
#
# ==== Example
#  # Create an Enum with some elements
#  class Priority < ClassyEnum::Base
#  end
#
#  class Priority::Low < Priority; end
#  class Priority::Medium < Priority; end
#  class Priority::High < Priority; end
#
#  Priority.find(:high) # => Priority::High.new
#  Priority.find('high') # => Priority::High.new
#  Priority.find {|e| e.to_sym == :high } # => Priority::High.new
Finds an enum instance by symbol, string, or block.
If a block is given, it passes each entry in enum to block, and returns
the first enum for which block is not false. If no enum matches, it
returns nil.

Example
Create an Enum with some elements
class Priority < ClassyEnum::Base
end




Finds an enum instance by symbol string or block . If a block is given it passes each entry in enum to block and returns the first enum for which block is not false . If no enum matches it returns nil . Example Create an Enum with some elements class Priority < ClassyEnum :: Base end
def find(key=nil)
        if block_given?
          super
        elsif map(&:to_s).include? key.to_s
          super { |e| e.to_s == key.to_s }
        end
      end
def find ( key = nil ) if block_given? super elsif map ( & :to_s ) . include? key . to_s super { | e | e . to_s == key . to_s } end end
Finds an enum instance by symbol, string, or block.
Finds an enum instance by symbol string or block .
key
<not_specific>