Sha256: 8b227265a5f115408dd8e410364e0272a2ce3af9bbb65c6af9e7044f951e8a92
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
module Restspec::Schema::Types module TypeMethods # @private # @!macro type_method # @!method $1(options = {}) # # Creates a new {$2} instance with the first argument # passed as parameter to the {$2} constructor. # # @param options [Hash, Object] A hash of options or # something to instantiate the type. def self.define_type_method(method_name, type_class) define_method(method_name) do |*args| type_class.new(*args) end end define_type_method :string, StringType define_type_method :integer, IntegerType define_type_method :decimal, DecimalType define_type_method :boolean, BooleanType define_type_method :decimal_string, DecimalStringType define_type_method :schema_id, SchemaIdType define_type_method :array, ArrayType define_type_method :one_of, OneOfType define_type_method :hash, HashType define_type_method :null, NullType define_type_method :embedded_schema, EmbeddedSchemaType define_type_method :date, DateType define_type_method :datetime, DateTimeType end end
Version data entries
5 entries across 5 versions & 1 rubygems