Module: Jschematic::Attributes::Format
- Defined in:
- lib/jschematic/attributes/format.rb
Defined Under Namespace
Classes: Cidr, Date, DateTime, IpAddress, Ipv6, NullFormat, Uri
Class Method Summary collapse
Class Method Details
.new(format) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/jschematic/attributes/format.rb', line 8 def self.new(format) format_class = format.split(/[^\w\d]/).inject("") do |name, part| name << part.capitalize end const_get(format_class).new rescue NameError NullFormat.new(format) end |