class Rasti::Types::Model

Attributes

model[R]

Public Class Methods

[](model) click to toggle source
# File lib/rasti/types/model.rb, line 9
def self.[](model)
  new(model)
end
new(model) click to toggle source
# File lib/rasti/types/model.rb, line 20
def initialize(model)
  @model = model
end

Public Instance Methods

inspect()
Alias for: to_s
to_s() click to toggle source
# File lib/rasti/types/model.rb, line 13
def to_s
  "#{self.class}[#{model}]"
end
Also aliased as: inspect

Private Instance Methods

transform(value) click to toggle source
# File lib/rasti/types/model.rb, line 28
def transform(value)
  value.is_a?(model) ? value : model.new(value)
end
valid?(value) click to toggle source
# File lib/rasti/types/model.rb, line 24
def valid?(value)
  value.is_a?(::Hash) || value.is_a?(model)
end