Module: ActiveTriples::Reflection::ClassMethods

Defined in:
lib/active_triples/reflection.rb

Instance Method Summary collapse

Instance Method Details

#has_property?(property) ⇒ Boolean

Returns true if the property exsits; false otherwise.

Parameters:

  • property (#to_s)

Returns:

  • (Boolean)

    true if the property exsits; false otherwise



64
65
66
# File 'lib/active_triples/reflection.rb', line 64

def has_property?(property)
  _active_triples_config.keys.include? property.to_s
end

#propertiesHash{String=>ActiveTriples::NodeConfig}

Returns a hash of property names and their configurations.

Returns:



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

def properties
  _active_triples_config
end

#properties=(val) ⇒ Hash{String=>ActiveTriples::NodeConfig}

Returns a hash of property names and their configurations.

Parameters:

Returns:



56
57
58
# File 'lib/active_triples/reflection.rb', line 56

def properties=(val)
  self._active_triples_config = val
end

#reflect_on_property(property) ⇒ ActiveTriples::NodeConfig

Returns the configuration for the property.

Parameters:

  • property (#to_s)

Returns:

Raises:



38
39
40
41
42
# File 'lib/active_triples/reflection.rb', line 38

def reflect_on_property(property)
  _active_triples_config.fetch(property.to_s) do
    raise ActiveTriples::UndefinedPropertyError.new(property.to_s, self)
  end
end