Method: LibGems::Requirement.create
- Defined in:
- lib/libgems/requirement.rb
.create(input) ⇒ Object
Factory method to create a LibGems::Requirement object. Input may be a Version, a String, or nil. Intended to simplify client code.
If the input is “weird”, the default version requirement is returned.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/libgems/requirement.rb', line 30 def self.create input case input when LibGems::Requirement then input when LibGems::Version, Array then new input else if input.respond_to? :to_str then new [input.to_str] else default end end end |