Class: CmisServer::PropertyDefinition
- Inherits:
-
Object
- Object
- CmisServer::PropertyDefinition
- Defined in:
- lib/cmis_server/property_definition.rb
Instance Attribute Summary collapse
-
#cardinality ⇒ Object
readonly
Todo add attributes constraints.
-
#choices ⇒ Object
readonly
Todo add attributes constraints.
-
#default_value ⇒ Object
readonly
Todo add attributes constraints.
-
#description ⇒ Object
readonly
Todo add attributes constraints.
-
#display_name ⇒ Object
readonly
Todo add attributes constraints.
-
#id ⇒ Object
readonly
Todo add attributes constraints.
-
#local_name ⇒ Object
readonly
Todo add attributes constraints.
-
#local_namespace ⇒ Object
readonly
Todo add attributes constraints.
-
#open_choice ⇒ Object
readonly
Todo add attributes constraints.
-
#orderable ⇒ Object
readonly
Todo add attributes constraints.
- #property_type ⇒ Object readonly
-
#query_name ⇒ Object
readonly
Todo add attributes constraints.
-
#queryable ⇒ Object
readonly
Todo add attributes constraints.
-
#required ⇒ Object
readonly
Todo add attributes constraints.
-
#type ⇒ Object
readonly
Todo add attributes constraints.
-
#updatability ⇒ Object
readonly
Todo add attributes constraints.
-
#value ⇒ Object
readonly
Todo add attributes constraints.
Class Method Summary collapse
Instance Method Summary collapse
- #getter_method_name ⇒ Object
- #inherited ⇒ Object
-
#initialize(attrs = {}) ⇒ PropertyDefinition
constructor
A new instance of PropertyDefinition.
- #property_method_name ⇒ Object
- #setter_method_name ⇒ Object
- #value_for(object) ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ PropertyDefinition
Returns a new instance of PropertyDefinition.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/cmis_server/property_definition.rb', line 60 def initialize(attrs={}) self.id = CmisServer::Id.new(attrs.fetch(:id).to_s) self.local_name = attrs.fetch(:local_name, id) self.local_namespace = attrs.fetch(:local_namespace, 'local') self.query_name = attrs.fetch(:query_name, id) self.display_name = attrs.fetch(:display_name, id) self.description = attrs.fetch(:description, "No description provided") self.property_type = attrs.fetch(:property_type, nil) self.cardinality = attrs.fetch(:cardinality, :single) self.updatability = attrs.fetch(:updatability, :readonly) self.required = attrs.fetch(:required, false) self.queryable = attrs.fetch(:queryable, false) self.orderable = attrs.fetch(:orderable, false) self.choices = attrs.fetch(:choices, nil) self.open_choice = attrs.fetch(:open_choice, false) self.default_value = attrs.fetch(:default_value, nil) self.value = attrs.fetch(:value, nil) self.type = attrs.fetch(:type, nil) end |
Instance Attribute Details
#cardinality ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def cardinality @cardinality end |
#choices ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def choices @choices end |
#default_value ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def default_value @default_value end |
#description ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def description @description end |
#display_name ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def display_name @display_name end |
#id ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def id @id end |
#local_name ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def local_name @local_name end |
#local_namespace ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def local_namespace @local_namespace end |
#open_choice ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def open_choice @open_choice end |
#orderable ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def orderable @orderable end |
#property_type ⇒ Object
84 85 86 |
# File 'lib/cmis_server/property_definition.rb', line 84 def property_type type.name.demodulize.downcase end |
#query_name ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def query_name @query_name end |
#queryable ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def queryable @queryable end |
#required ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def required @required end |
#type ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def type @type end |
#updatability ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def updatability @updatability end |
#value ⇒ Object
Todo add attributes constraints
20 21 22 |
# File 'lib/cmis_server/property_definition.rb', line 20 def value @value end |
Class Method Details
.property_defintions ⇒ Object
6 7 8 |
# File 'lib/cmis_server/property_definition.rb', line 6 def property_defintions @property_defintions end |
.register_property_definition(attrs) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/cmis_server/property_definition.rb', line 10 def register_property_definition(attrs) @property_defintions ||={} p =PropertyDefinition.new(attrs) @property_defintions[p.id]=p #ToDo Check definition conflicts end |
Instance Method Details
#getter_method_name ⇒ Object
88 89 90 |
# File 'lib/cmis_server/property_definition.rb', line 88 def getter_method_name self.id.to_method_name.to_sym end |
#inherited ⇒ Object
80 81 82 |
# File 'lib/cmis_server/property_definition.rb', line 80 def inherited false end |
#property_method_name ⇒ Object
96 97 98 |
# File 'lib/cmis_server/property_definition.rb', line 96 def property_method_name (self.id.to_method_name+'_property').to_sym end |
#setter_method_name ⇒ Object
92 93 94 |
# File 'lib/cmis_server/property_definition.rb', line 92 def setter_method_name (self.id.to_method_name+'=').to_sym end |
#value_for(object) ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/cmis_server/property_definition.rb', line 100 def value_for(object) case self.value when Proc self.value.call(object) else self.value end end |