class LiveResource::Resource

Attributes

dependencies[R]
name[R]

Public Class Methods

new(name, protocol) click to toggle source
# File lib/live_resource/resource.rb, line 6
def initialize(name, protocol)
  @name         = name
  @protocol     = protocol
  @dependencies = []
end

Public Instance Methods

identifier(*context) click to toggle source
# File lib/live_resource/resource.rb, line 12
def identifier(*context)
  raise "You must define an identifier method for the resource '#{@name}'" unless respond_to?(:_identifier)
  raw_identifier = _identifier(*context)
  @protocol.encode_identifier(raw_identifier)
end
push(*context) click to toggle source
# File lib/live_resource/resource.rb, line 18
def push(*context)
  @protocol.publish_resource_reset(identifier(*context))
end