Module: CaTissue::Resource

Includes:
CaRuby::Resource, Jinx::IdAlias
Included in:
CaTissue, Annotatable, Annotation
Defined in:
lib/catissue/resource.rb

Instance Method Summary collapse

Instance Method Details

#databaseDatabase

Returns the database which stores this object.

Returns:

  • (Database)

    the database which stores this object



22
23
24
# File 'lib/catissue/resource.rb', line 22

def database
  Database.current
end

#tolerant_match?(other, attributes) ⇒ Boolean

Returns whether each of the given attribute values either equals the respective other attribute value or one of the values is nil or ‘Not Specified’.

Parameters:

  • other (Resource)

    the domain object to compare

  • attributes (<Symbol>)

    the attributes to compare

Returns:

  • (Boolean)

    whether this domain object is a tolerant match with the other domain object on the given attributes



17
18
19
# File 'lib/catissue/resource.rb', line 17

def tolerant_match?(other, attributes)
  attributes.all? { |pa| Resource.tolerant_value_match?(send(pa), other.send(pa)) }
end