Class: IML::Text

Inherits:
String
  • Object
show all
Defined in:
lib/iml/text.rb

Overview

Parsing and mangling of text metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string = nil, options = {}) ⇒ Text

Returns a new instance of Text.


7
8
9
10
# File 'lib/iml/text.rb', line 7

def initialize(string = nil, options = {})
  @options = options
  super(string.to_s)
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options


5
6
7
# File 'lib/iml/text.rb', line 5

def options
  @options
end

Instance Method Details

#detect<IML::Movie>, <IML::TVSeries>

Determine if IML::Text matches rules for a media type

Returns:


19
20
21
# File 'lib/iml/text.rb', line 19

def detect
  tv? || movie? || false
end

#to_titleObject

Convert IML::Text to desired title format


13
14
15
# File 'lib/iml/text.rb', line 13

def to_title
  tr('.', ' ').tr('_', ' ').titleize
end