Sha256: 57f7e91294b0659cbde4671e456769afb715f29b0e26fc7601a95bde8558b935

Contents?: true

Size: 228 Bytes

Versions: 4

Compression:

Stored size: 228 Bytes

Contents

module Structural
  module Model
    class HasOne < Association
      def value_of(data)
        child = data.fetch(key) { raise MissingAttributeError, key }
        type.new(child) unless child.nil?
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
structural-0.1.0 lib/structural/model/has_one.rb
structural-0.0.3 lib/structural/model/has_one.rb
structural-0.0.2 lib/structural/model/has_one.rb
structural-0.0.1 lib/structural/model/has_one.rb