Class: MediaInfo::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/media_info/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Base

Returns a new instance of Base.



5
6
7
8
9
# File 'lib/media_info/base.rb', line 5

def initialize(filename)
  check_file(filename)

  @streams = Parser.call(filename)
end

Instance Attribute Details

#streamsObject (readonly)

Returns the value of attribute streams.



3
4
5
# File 'lib/media_info/base.rb', line 3

def streams
  @streams
end

Instance Method Details

#audioObject



53
54
55
# File 'lib/media_info/base.rb', line 53

def audio
  search_stream(:audio)
end

#audio?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/media_info/base.rb', line 25

def audio?
  stream?(:audio)
end

#generalObject



45
46
47
# File 'lib/media_info/base.rb', line 45

def general
  search_stream(:general)
end

#general?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/media_info/base.rb', line 17

def general?
  stream?(:general)
end

#imageObject



61
62
63
# File 'lib/media_info/base.rb', line 61

def image
  search_stream(:image)
end

#image?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/media_info/base.rb', line 33

def image?
  stream?(:image)
end


65
66
67
# File 'lib/media_info/base.rb', line 65

def menu
  search_stream(:menu)
end

Returns:

  • (Boolean)


37
38
39
# File 'lib/media_info/base.rb', line 37

def menu?
  stream?(:menu)
end

#otherObject



69
70
71
# File 'lib/media_info/base.rb', line 69

def other
  search_stream(:other)
end

#other?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/media_info/base.rb', line 41

def other?
  stream?(:other)
end

#streams_typesObject



11
12
13
14
15
# File 'lib/media_info/base.rb', line 11

def streams_types
  streams.map do |stream|
    stream.class::TYPE
  end.uniq
end

#textObject



57
58
59
# File 'lib/media_info/base.rb', line 57

def text
  search_stream(:text)
end

#text?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/media_info/base.rb', line 29

def text?
  stream?(:text)
end

#videoObject



49
50
51
# File 'lib/media_info/base.rb', line 49

def video
  search_stream(:video)
end

#video?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/media_info/base.rb', line 21

def video?
  stream?(:video)
end