Module: Sequencescape::Api::Resource::InstanceMethods

Included in:
Sequencescape::Api::Resource
Defined in:
lib/sequencescape-api/resource/instance_methods.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/sequencescape-api/resource/instance_methods.rb', line 2

def self.included(base)
  base.class_eval do
    attr_reader :api, :actions, :attributes, :uuid
    private :api, :actions, :attributes
    alias_method(:model, :class)
    alias_method(:id, :uuid)

    delegate :hash, :to => :uuid

    attribute_accessor :created_at, :updated_at, :conversion => :to_time
  end
end

Instance Method Details

#eql?(object_or_proxy) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/sequencescape-api/resource/instance_methods.rb', line 15

def eql?(object_or_proxy)
  return false unless object_or_proxy.respond_to?(:uuid)
  self.uuid.eql?(object_or_proxy.uuid)
end

#initialize(api, json = nil, wrapped = false) ⇒ InstanceMethods

Returns a new instance of InstanceMethods

Returns:



20
21
22
23
# File 'lib/sequencescape-api/resource/instance_methods.rb', line 20

def initialize(api, json = nil, wrapped = false)
  super
  @api, @attributes = api, {}
end