Sha256: eca1c6fd359ab0f4cf4fff4eea265e5d3cb958d7b6aff0a20ee0ffe945c6a73d

Contents?: true

Size: 440 Bytes

Versions: 3

Compression:

Stored size: 440 Bytes

Contents

class RestModel
  class Relation < Association
    autoload :Response, "rest_model/key/relation/response"
    include Response

    def initialize(name, options = {})
      super
      @has = options.fetch(:has, false)
    end

    def has?
      @has
    end

    def belongs?
      !has?
    end

    def from_source(value, resource = nil)
      nil
    end

    def relation?
      true
    end

    alias :parse  :from_source
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rest_model-0.3.1 lib/rest_model/key/relation.rb
rest_model-0.3.0 lib/rest_model/key/relation.rb
rest_model-0.2.3 lib/rest_model/key/relation.rb