Class: Application::DocumentTypeSpecification
- Defined in:
- lib/hotcocoa/application/document_type_specification.rb
Overview
This class represents the configuration for a document type, used by document-based applications. It is used to generate the Info.plist file
See http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/LaunchServicesConcepts/LSCConcepts/LSCConcepts.html for details.
Constant Summary collapse
- VALID_ROLES =
{:editor => "Editor", :viewer => "Viewer", :none => "None"}
Instance Attribute Summary collapse
-
#class ⇒ Object
writeonly
Sets the attribute class.
-
#extensions ⇒ Object
writeonly
Sets the attribute extensions.
-
#icon ⇒ Object
writeonly
Sets the attribute icon.
-
#name ⇒ Object
writeonly
Sets the attribute name.
-
#role ⇒ Object
writeonly
Sets the attribute role.
Instance Method Summary collapse
- #info_plist_representation ⇒ Object
-
#initialize {|_self| ... } ⇒ DocumentTypeSpecification
constructor
A new instance of DocumentTypeSpecification.
Constructor Details
#initialize {|_self| ... } ⇒ DocumentTypeSpecification
Returns a new instance of DocumentTypeSpecification.
23 24 25 26 27 28 29 30 31 |
# File 'lib/hotcocoa/application/document_type_specification.rb', line 23 def initialize unless block_given? msg = 'You must pass a block at initialization to declare the new document type' raise ArgumentError, msg end yield self verify! end |
Instance Attribute Details
#class=(value) ⇒ Object (writeonly)
Sets the attribute class
21 22 23 |
# File 'lib/hotcocoa/application/document_type_specification.rb', line 21 def class=(value) @class = value end |
#extensions=(value) ⇒ Object (writeonly)
Sets the attribute extensions
17 18 19 |
# File 'lib/hotcocoa/application/document_type_specification.rb', line 17 def extensions=(value) @extensions = value end |
#icon=(value) ⇒ Object (writeonly)
Sets the attribute icon
18 19 20 |
# File 'lib/hotcocoa/application/document_type_specification.rb', line 18 def icon=(value) @icon = value end |
#name=(value) ⇒ Object (writeonly)
Sets the attribute name
19 20 21 |
# File 'lib/hotcocoa/application/document_type_specification.rb', line 19 def name=(value) @name = value end |
#role=(value) ⇒ Object (writeonly)
Sets the attribute role
20 21 22 |
# File 'lib/hotcocoa/application/document_type_specification.rb', line 20 def role=(value) @role = value end |
Instance Method Details
#info_plist_representation ⇒ Object
TODO:
CFBundleTypeMIMETypes
TODO:
LSTypeIsPackage
TODO:
CFBundleTypeOSTypes
36 37 38 39 40 41 42 43 44 |
# File 'lib/hotcocoa/application/document_type_specification.rb', line 36 def info_plist_representation { CFBundleTypeExtensions: @extensions, CFBundleTypeIconFile: @icon, CFBundleTypeName: @name, CFBundleTypeRole: VALID_ROLES[@role], NSDocumentClass: @class } end |