Class: Cul::Image::Properties::Exif::TagEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/cul_image_props/image/properties/exif/types.rb

Overview

first element of tuple is tag name, optional second element is another dictionary giving names to values

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value = false) ⇒ TagEntry

Returns a new instance of TagEntry.



31
32
33
34
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 31

def initialize(name, value=false)
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



30
31
32
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 30

def name
  @name
end

#valueObject

Returns the value of attribute value.



30
31
32
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 30

def value
  @value
end

Instance Method Details

#translate(values) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 40

def translate(values)
  if @value
    if @value.respond_to? :call
      # value was a proc
      @value.call(values)
    else
      # value was a dictionary
      trans = ''
      values.each {|i| trans += (@value.include? i) ? @value[i] : i.inspect }
      trans
    end
  else
    values.inspect
  end
end

#translates?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 36

def translates?
  return (not ( @value.nil? or @value == false ))
end