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:



162
163
164
165
# File 'lib/origami/object.rb', line 162

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

Instance Method Details

#pre_buildObject

:nodoc:



261
262
263
264
265
266
# File 'lib/origami/object.rb', line 261

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.



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/origami/object.rb', line 271

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

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

    version = attributes[:Version] || '1.0'
    level = attributes[:ExtensionLevel] || 0
    current = [version, level]

    max = [max, current, self[field.value].version_required].max
  end

  max
end