Class: MPD::Controller::Stickers::Sticker

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element, name) ⇒ Sticker

Returns a new instance of Sticker.



17
18
19
20
# File 'lib/mpd/controller/stickers.rb', line 17

def initialize (element, name)
	@element = element
	@name    = name
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



15
16
17
# File 'lib/mpd/controller/stickers.rb', line 15

def element
  @element
end

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/mpd/controller/stickers.rb', line 15

def name
  @name
end

Instance Method Details

#delete!Object



33
34
35
# File 'lib/mpd/controller/stickers.rb', line 33

def delete!
	@element.stickers.controller.do_and_raise_if_needed(:sticker, :delete, element.type, element.uri, name)
end

#inspectObject



37
38
39
# File 'lib/mpd/controller/stickers.rb', line 37

def inspect
	"#<#{self.class.name}(#{name}): #{value.inspect}>"
end

#valueObject



22
23
24
25
26
27
# File 'lib/mpd/controller/stickers.rb', line 22

def value
	response    = @element.stickers.controller.do_and_raise_if_needed(:sticker, :get, element.type, element.uri, name)
	name, value = response.first.last.split '=', 2

	value
end

#value=(value) ⇒ Object



29
30
31
# File 'lib/mpd/controller/stickers.rb', line 29

def value= (value)
	@element.stickers.controller.do_and_raise_if_needed(:sticker, :set, element.type, element.uri, name, value)
end