Class: ActiveSP::Field
- Extended by:
- Caching
- Defined in:
- lib/activesp/field.rb
Instance Attribute Summary collapse
- #ID ⇒ Object readonly
- #internal_type ⇒ Object readonly
- #Name ⇒ Object readonly
-
#parent ⇒ Field
readonly
Returns the parent field.
-
#scope ⇒ Site, List
readonly
Returns the scope of the field.
Instance Method Summary collapse
-
#initialize(scope, id, name, type, parent, attributes_before_type_cast) ⇒ Field
constructor
There is no call to get to the field info directly, so these should always be accessed through the site or list they belong to.
-
#key ⇒ String
See Base#key.
- #List ⇒ Object
- #Mult ⇒ Object
- #ReadOnly ⇒ Object
-
#save ⇒ void
See Base#save.
- #to_s ⇒ Object (also: #inspect)
- #Type ⇒ Object
Methods included from Caching
Methods inherited from Base
#attribute, #attribute_type, #attribute_types, #attributes, #has_attribute?, #has_writable_attribute?, #method_missing, #reload, #set_attribute
Constructor Details
#initialize(scope, id, name, type, parent, attributes_before_type_cast) ⇒ Field
There is no call to get to the field info directly, so these should always be accessed through the site or list they belong to. Hence, we do not use caching here as it is useless.
47 48 49 50 |
# File 'lib/activesp/field.rb', line 47 def initialize(scope, id, name, type, parent, attributes_before_type_cast) @scope, @ID, @Name, @internal_type, @parent, @attributes_before_type_cast = scope, id, name, type, parent, attributes_before_type_cast @site = Site === @scope ? @scope : @scope.site end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveSP::Base
Instance Attribute Details
#ID ⇒ Object (readonly)
35 36 37 |
# File 'lib/activesp/field.rb', line 35 def ID @ID end |
#internal_type ⇒ Object (readonly)
35 36 37 |
# File 'lib/activesp/field.rb', line 35 def internal_type @internal_type end |
#Name ⇒ Object (readonly)
35 36 37 |
# File 'lib/activesp/field.rb', line 35 def Name @Name end |
#parent ⇒ Field (readonly)
Returns the parent field. This is the field defined on the containing site in case the field has a list as scope
41 42 43 |
# File 'lib/activesp/field.rb', line 41 def parent @parent end |
Instance Method Details
#key ⇒ String
See Base#key
54 55 56 |
# File 'lib/activesp/field.rb', line 54 def key encode_key("A", [@scope.key, @ID]) end |
#List ⇒ Object
59 60 61 |
# File 'lib/activesp/field.rb', line 59 def List list_for_lookup end |
#Mult ⇒ Object
69 70 71 |
# File 'lib/activesp/field.rb', line 69 def Mult !!attributes["Mult"] end |
#ReadOnly ⇒ Object
74 75 76 |
# File 'lib/activesp/field.rb', line 74 def ReadOnly !!attributes["ReadOnly"] end |
#save ⇒ void
This method returns an undefined value.
See Base#save
80 81 82 |
# File 'lib/activesp/field.rb', line 80 def save p untype_cast_attributes(@site, nil, internal_attribute_types, changed_attributes) end |
#to_s ⇒ Object Also known as: inspect
85 86 87 |
# File 'lib/activesp/field.rb', line 85 def to_s "#<ActiveSP::Field name=#{self.Name}>" end |
#Type ⇒ Object
64 65 66 |
# File 'lib/activesp/field.rb', line 64 def Type translate_internal_type(self) end |