Class: ID3Tag::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/id3tag/scope.rb

Constant Summary collapse

UnsupportedScopeError =
Class.new(ArgumentError)
SUPPORTED_SCOPES =
[:v1, :v2, :all]

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ Scope

Returns a new instance of Scope.



6
7
8
9
10
11
12
13
# File 'lib/id3tag/scope.rb', line 6

def initialize(version)
  raise UnsupportedScopeError unless SUPPORTED_SCOPES.include?(version)
  if version == :all
    @included_versions = [:v1, :v2]
  else
    @included_versions = [version]
  end
end

Instance Method Details

#include?(version) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/id3tag/scope.rb', line 15

def include?(version)
  @included_versions.include?(version)
end