Class: ImageVoodoo::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/image_voodoo/metadata.rb

Instance Method Summary collapse

Constructor Details

#initialize(metadata) ⇒ Directory

Returns a new instance of Directory.



51
52
53
# File 'lib/image_voodoo/metadata.rb', line 51

def initialize()
  @directory = .get_directory self.class.directory_class.java_class
end

Instance Method Details

#[](tag_name) ⇒ Object

Return tag value for the tag specified or nil if there is none defined.



64
65
66
67
68
69
70
71
# File 'lib/image_voodoo/metadata.rb', line 64

def [](tag_name)
  return nil unless @directory
  (tag_type, tag_method) = self.class::TAGS[tag_name.to_s]
  raise ArgumentError.new "Unkown tag_name: #{tag_name}" unless tag_type
  java_tag_type = self.class.directory_class.const_get tag_type
  return nil unless @directory.contains_tag java_tag_type
  @directory.__send__ tag_method, java_tag_type
end

#exists?Boolean

Does the directory you requested exist as metadata for this image.

Returns:

  • (Boolean)


57
58
59
# File 'lib/image_voodoo/metadata.rb', line 57

def exists?
  !!@directory
end