Sha256: 0425f747d233bb3e23520202161429246047db20ba6e35f3e39effd26a68f323
Contents?: true
Size: 752 Bytes
Versions: 1
Compression:
Stored size: 752 Bytes
Contents
module SwaggerYard # # Holds the name and type for a single model property # class Property attr_reader :name, :description def self.from_tag(tag) name, options_string = tag.name.split(/[\(\)]/) required = options_string.to_s.split(',').map(&:strip).include?('required') new(name, tag.types, tag.text, required) end def initialize(name, types, description, required) @name, @description, @required = name, description, required @type = Type.from_type_list(types) end def required? @required end def model_name @type.model_name end def to_h result = @type.to_h result["description"] = description if description result end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
swagger_yard-0.1.0 | lib/swagger_yard/property.rb |