Class: MPXJ::Container
- Inherits:
-
Object
- Object
- MPXJ::Container
- Defined in:
- lib/mpxj/container.rb
Overview
Base class from which all project entities are derived
Direct Known Subclasses
Instance Attribute Summary collapse
-
#parent_project ⇒ Object
readonly
Returns the value of attribute parent_project.
Instance Method Summary collapse
-
#initialize(parent_project, attribute_types, attribute_values) ⇒ Container
constructor
A new instance of Container.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(parent_project, attribute_types, attribute_values) ⇒ Container
Returns a new instance of Container.
8 9 10 11 12 |
# File 'lib/mpxj/container.rb', line 8 def initialize(parent_project, attribute_types, attribute_values) @parent_project = parent_project @attribute_types = attribute_types @attribute_values = attribute_values end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mpxj/container.rb', line 14 def method_missing(name, *args, &block) # We can probably do this more efficiently with dynamic methods... but let's get some feedback first! attribute_name = name.to_s attribute_type = @attribute_types[attribute_name] attribute_value = @attribute_values[attribute_name] if attribute_type.nil? && attribute_value.nil? super else if attribute_type.nil? attribute_type = 1 end get_attribute_value(attribute_type, attribute_value) end end |
Instance Attribute Details
#parent_project ⇒ Object (readonly)
Returns the value of attribute parent_project.
7 8 9 |
# File 'lib/mpxj/container.rb', line 7 def parent_project @parent_project end |