Class: ActiveSP::GhostField
- Inherits:
-
Object
- Object
- ActiveSP::GhostField
- Includes:
- Util
- Defined in:
- lib/activesp/ghost_field.rb
Overview
This class represents the field definitions for objects in SharePoint for which the fields cannot be changed and are thus not represented by an object in SharePoint. These include fields of sites, lists, users, grouos, roles, content types and fields. The interface of this class is not as complete as the interface if a Field, mainly because it does not make much sense to do so
Instance Attribute Summary collapse
- #internal_type ⇒ Object readonly
- #Mult ⇒ Object readonly
- #Name ⇒ Object readonly
- #ReadOnly ⇒ Object readonly
Instance Method Summary collapse
-
#attribute(name) ⇒ Integer, ...
Returns the value of the attribute of the given name, or nil if this object does not have an attribute by the given name.
-
#attributes ⇒ Hash{String => Integer, Float, String, Time, Boolean, Base}
Returns the attributes of this object as a Hash.
-
#has_attribute?(name) ⇒ Boolean
Returns whether or not this object has an attribute with the given name.
-
#initialize(name, type, mult, read_only) ⇒ GhostField
constructor
A new instance of GhostField.
-
#method_missing(m, *a, &b) ⇒ Object
See Base#method_missing.
- #Type ⇒ Object
Constructor Details
#initialize(name, type, mult, read_only) ⇒ GhostField
Returns a new instance of GhostField.
41 42 43 |
# File 'lib/activesp/ghost_field.rb', line 41 def initialize(name, type, mult, read_only) @Name, @internal_type, @Mult, @ReadOnly = name, type, mult, read_only end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a, &b) ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/activesp/ghost_field.rb', line 71 def method_missing(m, *a, &b) ms = m.to_s if a.length == 0 && has_attribute?(ms) attribute(ms) else super end end |
Instance Attribute Details
#internal_type ⇒ Object (readonly)
38 39 40 |
# File 'lib/activesp/ghost_field.rb', line 38 def internal_type @internal_type end |
#Mult ⇒ Object (readonly)
38 39 40 |
# File 'lib/activesp/ghost_field.rb', line 38 def Mult @Mult end |
#Name ⇒ Object (readonly)
38 39 40 |
# File 'lib/activesp/ghost_field.rb', line 38 def Name @Name end |
#ReadOnly ⇒ Object (readonly)
38 39 40 |
# File 'lib/activesp/ghost_field.rb', line 38 def ReadOnly @ReadOnly end |
Instance Method Details
#attribute(name) ⇒ Integer, ...
Returns the value of the attribute of the given name, or nil if this object does not have an attribute by the given name
59 60 61 |
# File 'lib/activesp/ghost_field.rb', line 59 def attribute(name) current_attributes[name] end |
#attributes ⇒ Hash{String => Integer, Float, String, Time, Boolean, Base}
Returns the attributes of this object as a Hash
52 53 54 |
# File 'lib/activesp/ghost_field.rb', line 52 def attributes original_attributes.dup end |
#has_attribute?(name) ⇒ Boolean
Returns whether or not this object has an attribute with the given name
66 67 68 |
# File 'lib/activesp/ghost_field.rb', line 66 def has_attribute?(name) current_attributes.has_key?(name) end |
#Type ⇒ Object
46 47 48 |
# File 'lib/activesp/ghost_field.rb', line 46 def Type translate_internal_type(self) end |