Sha256: 2fe7aaa967027ee06ad99e6ab0873e12617b0acac92d96f381a9627d6eda589d
Contents?: true
Size: 742 Bytes
Versions: 2
Compression:
Stored size: 742 Bytes
Contents
class Restspec::Schema::Types::BasicType def initialize(options = {}) self.options = options end def |(other_type) self.disjuction = other_type self end def of(other_type) self.parameterized_type = other_type self end def totally_valid?(attribute, value) if disjuction.present? valid?(attribute, value) || disjuction.valid?(attribute, value) else valid?(attribute, value) end end def to_s self.class.name.demodulize.gsub(/Type$/, "").underscore end private attr_accessor :options, :disjuction, :parameterized_type def example_options options.fetch(:example_options, options) end def schema_options options.fetch(:schema_options, options) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
restspec-0.0.4 | lib/restspec/schema/types/basic_type.rb |
restspec-0.0.3 | lib/restspec/schema/types/basic_type.rb |