Module: Origami::StandardObject

Included in:
Action, Action::GoToE::EmbeddedTarget, Action::Launch::WindowsLaunchParams, Action::RichMediaExecute::Command, AnimationStyle3D, Annotation, Annotation::AdditionalActions, Annotation::AppearanceCharacteristics, Annotation::AppearanceDictionary, Annotation::Artwork3D::Activation, Annotation::BorderEffect, Annotation::BorderStyle, Annotation::RichMedia::Activation, Annotation::RichMedia::Animation, Annotation::RichMedia::Configuration, Annotation::RichMedia::Content, Annotation::RichMedia::CuePoint, Annotation::RichMedia::Deactivation, Annotation::RichMedia::Instance, Annotation::RichMedia::Parameters, Annotation::RichMedia::Position, Annotation::RichMedia::Presentation, Annotation::RichMedia::Settings, Annotation::RichMedia::Window, Background3D, Catalog, CatalogAdditionalActions, Collection, Collection::Color, Collection::Folder, Collection::Item, Collection::Navigator, Collection::Schema, Collection::Sort, Collection::Split, Collection::Subitem, CrossSection3D, DestinationDictionary, DeveloperExtension, EmbeddedFileParameters, EmbeddedFileStream, Encoding, Encryption::CryptFilterDictionary, Encryption::EncryptionDictionary, Extensions, FDF::Catalog, FDF::Dictionary, FDF::Field, FDF::IconFit, FDF::JavaScript, FDF::NamedPageReference, FDF::Page, FDF::Template, Field::AdditionalActions, Field::CertificateSeedValue, Field::SignatureLock, Field::SignatureSeedValue, Field::Subform, FileSpec, Filter::CCITTFax::DecodeParms, Filter::Crypt::DecodeParms, Filter::DCT::DecodeParms, Filter::JBIG2::DecodeParms, Filter::Predictor::DecodeParms, Font, FontDescriptor, Function::Exponential, Function::Stitching, Graphics::ExtGState, Graphics::FormXObject::Group, Graphics::FormXObject::Reference, Graphics::Pattern::Shading, Graphics::Pattern::Shading::Axial, Graphics::Pattern::Shading::FunctionBased, Graphics::Pattern::Shading::Radial, Graphics::ReferenceDictionary, InteractiveForm, LightingScheme3D, Linearization, Measurement3D, Metadata, MetadataStream, NameTreeNode, Names, Node3D, NumberTreeNode, OptionalContent::Configuration, OptionalContent::Group, OptionalContent::Membership, OptionalContent::Properties, OptionalContent::Usage, OptionalContent::Usage::CreatorInfo, OptionalContent::Usage::Export, OptionalContent::Usage::Language, OptionalContent::Usage::PageElement, OptionalContent::Usage::Print, OptionalContent::Usage::User, OptionalContent::Usage::View, OptionalContent::Usage::Zoom, OptionalContent::UsageApplication, Outline, OutlineItem, OutputIntent, PPKLite::AddressList, PPKLite::Catalog, PPKLite::Certificate, PPKLite::PPK, PPKLite::User, PPKLite::UserList, Page, Page::AdditionalActions, Page::BoxColorInformation, Page::BoxStyle, Page::NavigationNode, PageLabel, PageTreeNode, Perms, Projection3D, Reference3D, RenderMode3D, Requirement, Requirement::Handler, Resources, Origami::Signature::BuildData, Origami::Signature::BuildProperties, Origami::Signature::DigitalSignature, Origami::Signature::Reference, Stream, Trailer, U3DStream, Units3D, UsageRights::TransformParams, View3D, ViewerPreferences, WebCapture::Command, WebCapture::CommandSettings, WebCapture::ContentSet, WebCapture::SourceInformation, WebCapture::SpiderInfo, XRefStream
Defined in:
lib/origami/object.rb

Overview

Mixin’ module for objects which can store their options into an inner Dictionary.

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

DEFAULT_ATTRIBUTES =

:nodoc:

{ :Type => Object, :Version => "1.2" }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object

:nodoc:



120
121
122
123
# File 'lib/origami/object.rb', line 120

def self.included(receiver) #:nodoc:
    receiver.instance_variable_set(:@fields, Hash.new(DEFAULT_ATTRIBUTES))
    receiver.extend(ClassMethods)
end

Instance Method Details

#pre_buildObject

:nodoc:



206
207
208
209
210
211
# File 'lib/origami/object.rb', line 206

def pre_build #:nodoc:
    set_default_values
    do_type_check if Origami::OPTIONS[:enable_type_checking] == true

    super
end

#version_requiredObject

Returns the version and level required by the current Object.



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/origami/object.rb', line 216

def version_required #:nodoc:
    max = [ 1.0, 0 ]

    self.each_key do |field|
        attributes = self.class.fields[field.value]
        if attributes.nil?
            STDERR.puts "Warning: object #{self.class} has undocumented field #{field.value}"
            next
        end

        current_version = attributes.has_key?(:Version) ? attributes[:Version].to_f : 0
        current_level = attributes[:ExtensionLevel] || 0
        current = [ current_version, current_level ]

        max = current if (current <=> max) > 0

        sub = self[field.value].version_required
        max = sub if (sub <=> max) > 0
    end

    max
end