Sha256: 0186a0b797bbd4a7e3a5a68e9c1098450776132b56a155d5e1ff1c492f7d8f4a

Contents?: true

Size: 526 Bytes

Versions: 11

Compression:

Stored size: 526 Bytes

Contents

u = up.util

class up.Record

  fields: ->
    throw 'Return an array of property names'

  constructor: (options) ->
    u.assign(this, @attributes(options))

  attributes: (source = @) ->
    u.only(source, @fields()...)

  "#{u.copy.key}": ->
    @variant()

  variant: (changes = {}) ->
    attributesWithChanges = u.merge(@attributes(), changes)
    new @constructor(attributesWithChanges)

  "#{u.isEqual.key}": (other) ->
    other && (@constructor == other.constructor) && u.isEqual(@attributes(), other.attributes())

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unpoly-rails-1.0.3 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-1.0.1 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-1.0.0 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-0.62.1 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-0.62.0 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-0.61.1 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-0.61.0 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-0.60.3 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-0.60.2 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-0.60.1 lib/assets/javascripts/unpoly/classes/record.coffee
unpoly-rails-0.60.0 lib/assets/javascripts/unpoly/classes/record.coffee