Class: ActiveSP::Field
- Inherits:
-
Base
- Object
- Base
- ActiveSP::Field
- Extended by:
- Caching
- Includes:
- InSite, Util
- Defined in:
- lib/activesp/field.rb
Instance Attribute Summary (collapse)
- - (Object) ID readonly
- - (Object) internal_type readonly
- - (Object) Name readonly
-
- (Field) parent
readonly
Returns the parent field.
-
- (Site, List) scope
readonly
Returns the scope of the field.
Instance Method Summary (collapse)
-
- (Field) initialize(scope, id, name, type, parent, attributes_before_type_cast)
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.
-
- (String) key
See Base#key.
- - (Object) List
- - (Object) Mult
- - (Object) ReadOnly
-
- (void) save
See Base#save.
- - (Object) to_s (also: #inspect)
- - (Object) Type
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
- (Field) initialize(scope, id, name, type, parent, attributes_before_type_cast)
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
- (Object) ID (readonly)
35 36 37 |
# File 'lib/activesp/field.rb', line 35 def ID @ID end |
- (Object) internal_type (readonly)
35 36 37 |
# File 'lib/activesp/field.rb', line 35 def internal_type @internal_type end |
- (Object) Name (readonly)
35 36 37 |
# File 'lib/activesp/field.rb', line 35 def Name @Name end |
- (Field) parent (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
- (String) key
See Base#key
54 55 56 |
# File 'lib/activesp/field.rb', line 54 def key encode_key("A", [@scope.key, @ID]) end |
- (Object) List
59 60 61 |
# File 'lib/activesp/field.rb', line 59 def List list_for_lookup end |
- (Object) Mult
69 70 71 |
# File 'lib/activesp/field.rb', line 69 def Mult !!attributes["Mult"] end |
- (Object) ReadOnly
74 75 76 |
# File 'lib/activesp/field.rb', line 74 def ReadOnly !!attributes["ReadOnly"] end |
- (void) save
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 |
- (Object) to_s Also known as: inspect
85 86 87 |
# File 'lib/activesp/field.rb', line 85 def to_s "#<ActiveSP::Field name=#{self.Name}>" end |
- (Object) Type
64 65 66 |
# File 'lib/activesp/field.rb', line 64 def Type translate_internal_type(self) end |