Class: MPD::Controller::Database::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/mpd/controller/database.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database, tag, name) ⇒ Element

Returns a new instance of Element.



161
162
163
164
165
# File 'lib/mpd/controller/database.rb', line 161

def initialize (database, tag, name)
	@database = database
	@tag      = tag
	@name     = name
end

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



159
160
161
# File 'lib/mpd/controller/database.rb', line 159

def database
  @database
end

#nameObject (readonly)

Returns the value of attribute name.



159
160
161
# File 'lib/mpd/controller/database.rb', line 159

def name
  @name
end

#tagObject (readonly)

Returns the value of attribute tag.



159
160
161
# File 'lib/mpd/controller/database.rb', line 159

def tag
  @tag
end

Instance Method Details

#inspectObject



175
176
177
# File 'lib/mpd/controller/database.rb', line 175

def inspect
	"#<#{self.class.name.sub(/::Element$/, "::#{tag.capitalize}")}: #{name.inspect}>"
end

#nil?Boolean

Returns:

  • (Boolean)


167
168
169
# File 'lib/mpd/controller/database.rb', line 167

def nil?
	name.empty?
end

#songs(strict = false) ⇒ Object



171
172
173
# File 'lib/mpd/controller/database.rb', line 171

def songs (strict = false)
	database.search(name, tag: tag, strict: strict)
end