Class: BaseConcept
- Inherits:
-
Object
- Object
- BaseConcept
- Defined in:
- lib/libisi/concept/base.rb
Overview
Copyright © 2007-2010 Logintas AG Switzerland
This file is part of Libisi.
Libisi is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Libisi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Libisi. If not, see <www.gnu.org/licenses/>.
Direct Known Subclasses
Constant Summary collapse
- VALUE_TYPES =
[:attributes, :properties, :relations]
Instance Attribute Summary collapse
-
#base_class ⇒ Object
readonly
Returns the value of attribute base_class.
Instance Method Summary collapse
-
#attribute_names ⇒ Object
There are by default no attributes.
- #attributes ⇒ Object
-
#initialize(base_class, options = {}) ⇒ BaseConcept
constructor
A new instance of BaseConcept.
- #properties ⇒ Object
- #property_names ⇒ Object
- #value_accessors ⇒ Object
Constructor Details
#initialize(base_class, options = {}) ⇒ BaseConcept
Returns a new instance of BaseConcept.
24 25 26 |
# File 'lib/libisi/concept/base.rb', line 24 def initialize(base_class, = {}) @base_class = base_class end |
Instance Attribute Details
#base_class ⇒ Object (readonly)
Returns the value of attribute base_class.
22 23 24 |
# File 'lib/libisi/concept/base.rb', line 22 def base_class @base_class end |
Instance Method Details
#attribute_names ⇒ Object
There are by default no attributes
29 |
# File 'lib/libisi/concept/base.rb', line 29 def attribute_names; []; end |
#attributes ⇒ Object
30 |
# File 'lib/libisi/concept/base.rb', line 30 def attributes; []; end |
#properties ⇒ Object
48 49 50 51 52 |
# File 'lib/libisi/concept/base.rb', line 48 def properties property_names.map {|p| Property.create(base_class, p) } end |
#property_names ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/libisi/concept/base.rb', line 32 def property_names ans = attribute_names rns = relation_names base_class.instance_methods.reject {|mn| base_class.instance_method(mn).arity != 0 or mn =~ /^to_/ or mn =~/^get_/ or mn =~/^set_/ or mn =~ /=$/ or mn =~ /_type$/ or mn =~ /_unit$/ or ans.include?(mn) or rns.include?(mn) } end |
#value_accessors ⇒ Object
54 55 56 |
# File 'lib/libisi/concept/base.rb', line 54 def value_accessors VALUE_TYPES.map {|vt| self.send(vt)}.flatten end |