Module: Spira

Defined in:
lib/spira.rb,
lib/spira/base.rb,
lib/spira/type.rb,
lib/spira/types.rb,
lib/spira/utils.rb,
lib/spira/version.rb,
lib/spira/resource.rb,
lib/spira/exceptions.rb,
lib/spira/persistence.rb,
lib/spira/reflections.rb,
lib/spira/validations.rb,
lib/spira/serialization.rb,
lib/spira/validations/uniqueness.rb

Overview

Spira is a framework for building projections of RDF data into Ruby classes. It is built on top of RDF.rb.

Defined Under Namespace

Modules: Persistence, Reflections, Resource, Serialization, Type, Types, Utils, VERSION, Validations Classes: Base, NoRepositoryError, NoTypeError, PropertyMissingError, RecordInvalid, RecordNotSaved, ResourceDeclarationError, SpiraError

Class Method Summary collapse

Class Method Details

.repositoryRDF::Repository

The RDF::Repository used (reader)

Returns:

See Also:



38
39
40
# File 'lib/spira.rb', line 38

def repository
  Thread.current[:repository]
end

.repository=(repository) ⇒ RDF::Repository

The RDF::Repository used (reader)

Returns:

See Also:



48
49
50
# File 'lib/spira.rb', line 48

def repository=(repository)
  Thread.current[:repository] = repository
end

.type_alias(new, original) ⇒ Void

Alias a property type to another. This allows a range of options to be specified for a property type which all reference one Spira::Type

Parameters:

  • new (Any)

    The new symbol or reference

  • original (Any)

    The type the new symbol should refer to

Returns:

  • (Void)


88
89
90
# File 'lib/spira.rb', line 88

def type_alias(new, original)
  types[new] = original
end

.typesHash{Symbol => Spira::Type}

The list of all property types available for Spira resources

Returns:

See Also:



28
29
30
# File 'lib/spira.rb', line 28

def types
  @types ||= {}
end

.using_repository(repo) { ... } ⇒ RDF::Repository

Execute a block on a specific repository

Parameters:

Yields:

  • the block with the instructions while using the repository

Returns:



69
70
71
72
73
74
75
76
# File 'lib/spira.rb', line 69

def using_repository(repo)
  old_repository = Spira.repository
  Spira.repository = repo
  yield if block_given?
  repo
ensure
  Spira.repository = old_repository
end