Module: Mp3gain::Chainable

Included in:
Mp3gain, Mp3gain
Defined in:
lib/mp3gain/chainable.rb

Overview

Offers methods like path, target_db etc. to be chained together

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mp3gainObject

Returns the value of attribute mp3gain.



7
8
9
# File 'lib/mp3gain/chainable.rb', line 7

def mp3gain
  @mp3gain
end

Instance Method Details

#do_preserve_timestamp(preserve: true) ⇒ Object



23
24
25
26
27
28
# File 'lib/mp3gain/chainable.rb', line 23

def do_preserve_timestamp(preserve: true)
  raise 'Please set a path first.' if @mp3gain.nil?

  @mp3gain.preserve_timestamp = preserve
  @mp3gain
end

#path(mp3_gain_path) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
# File 'lib/mp3gain/chainable.rb', line 9

def path(mp3_gain_path)
  raise ArgumentError, 'Mp3gain path can\'t be null' if mp3_gain_path.nil?

  @mp3gain = Mp3gain.new(mp3_gain_path)
  @mp3gain.mp3gain = @mp3gain
end

#with_target_db(target_db) ⇒ Object



16
17
18
19
20
21
# File 'lib/mp3gain/chainable.rb', line 16

def with_target_db(target_db)
  raise 'Please set a path first.' if @mp3gain.nil?

  @mp3gain.target_db = target_db
  @mp3gain
end