Class: GDCM::Package::Info
- Inherits:
-
Object
- Object
- GDCM::Package::Info
- Defined in:
- lib/gdcm/package/info.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
Instance Method Summary collapse
- #data ⇒ Object
- #dump ⇒ Object
- #identify ⇒ Object
-
#initialize(base) ⇒ Info
constructor
A new instance of Info.
- #meta ⇒ Object
- #meta=(value) ⇒ Object
- #raw ⇒ Object
Constructor Details
#initialize(base) ⇒ Info
Returns a new instance of Info.
6 7 8 |
# File 'lib/gdcm/package/info.rb', line 6 def initialize base @base = base end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
4 5 6 |
# File 'lib/gdcm/package/info.rb', line 4 def base @base end |
Instance Method Details
#data ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gdcm/package/info.rb', line 19 def data if .respond_to?(:lines) .lines.each_with_object({}) do |line, memo| case line when /^MediaStorage is (?<media_storage>[\d.]+)/ memo['MediaStorage'] = $~[:media_storage] when /^TransferSyntax is (?<transfer_syntax>[\d.]+)/ memo['TransferSyntax'] = $~[:transfer_syntax] else key, _, value = line.partition(/:[\s]*/).map(&:strip) memo[key] = value end end end end |
#dump ⇒ Object
44 45 46 47 48 49 |
# File 'lib/gdcm/package/info.rb', line 44 def dump GDCM::Tool::Dump.new do |builder| yield builder if block_given? builder << base.path end end |
#identify ⇒ Object
51 52 53 54 55 56 |
# File 'lib/gdcm/package/info.rb', line 51 def identify GDCM::Tool::Identify.new do |builder| yield builder if block_given? builder << base.path end end |
#meta ⇒ Object
36 37 38 |
# File 'lib/gdcm/package/info.rb', line 36 def @meta ||= identify end |
#meta=(value) ⇒ Object
40 41 42 |
# File 'lib/gdcm/package/info.rb', line 40 def value @meta = value end |
#raw ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/gdcm/package/info.rb', line 10 def raw dump.lines.each_with_object([]) do |line, memo| case line when /^\s*\((?<package>[0-9a-f]{4},[0-9a-f]{4})\)/ puts line end end end |