Class: XmpToolkitRuby::XmpValue

Inherits:
Object
  • Object
show all
Defined in:
lib/xmp_toolkit_ruby/xmp_value.rb

Constant Summary collapse

TYPES =
%i[string bool int int64 float date].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, type: nil) ⇒ XmpValue

Returns a new instance of XmpValue.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
# File 'lib/xmp_toolkit_ruby/xmp_value.rb', line 9

def initialize(value, type: nil)
  @value = value
  @type = type.to_sym

  raise ArgumentError, "Invalid type: #{type}" unless TYPES.include?(@type)
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/xmp_toolkit_ruby/xmp_value.rb', line 5

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/xmp_toolkit_ruby/xmp_value.rb', line 5

def value
  @value
end