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)

See Also:


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

def repository
  Thread.current[:repository]
end

.repository=(repository) ⇒ RDF::Repository

The RDF::Repository used (reader)

See Also:


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

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


86
87
88
# File 'lib/spira.rb', line 86

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

.typesHash{Symbol => Spira::Type}

The list of all property types available for Spira resources

See Also:


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

def types
  @types ||= {}
end

.using_repository(repo) { ... } ⇒ Object

Execute a block on a specific repository

Yields:

  • the block with the instructions while using the repository


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

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