Class: GreenStripes::Album

Inherits:
Object
  • Object
show all
Defined in:
lib/greenstripes.rb,
ext/greenstripes/greenstripes.c

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



130
131
132
# File 'lib/greenstripes.rb', line 130

def ==(other)
  self.to_link == other.to_link
end

#artistnil

Returns the album’s artist.

Returns:

  • (nil)


1015
1016
1017
1018
1019
1020
1021
# File 'ext/greenstripes/greenstripes.c', line 1015

static VALUE album_artist(VALUE self)
{
  sp_album *album;
  Data_Get_Struct(self, sp_album, album);
  sp_artist *artist = sp_album_artist(album);
  return artist ? Data_Wrap_Struct(class_artist, NULL, NULL, artist) : Qnil;
}

#loaded?Boolean

Returns true if the album is loaded, false otherwise.

Returns:

  • (Boolean)


1003
1004
1005
1006
1007
1008
# File 'ext/greenstripes/greenstripes.c', line 1003

static VALUE album_loaded(VALUE self)
{
  sp_album *album;
  Data_Get_Struct(self, sp_album, album);
  return sp_album_is_loaded(album) ? Qtrue : Qfalse;
}

#nameString?

Returns the album’s name.

Returns:



1028
1029
1030
1031
1032
1033
1034
# File 'ext/greenstripes/greenstripes.c', line 1028

static VALUE album_name(VALUE self)
{
  sp_album *album;
  Data_Get_Struct(self, sp_album, album);
  const char *name = sp_album_name(album);
  return name ? rb_str_new2(name) : Qnil;
}


126
127
128
# File 'lib/greenstripes.rb', line 126

def to_link
  Link.new(self)
end

#yearFixnum?

Returns the year the album was released.

Returns:

  • (Fixnum, nil)


1041
1042
1043
1044
1045
1046
1047
# File 'ext/greenstripes/greenstripes.c', line 1041

static VALUE album_year(VALUE self)
{
  sp_album *album;
  Data_Get_Struct(self, sp_album, album);
  int year = sp_album_year(album);
  return year ? INF2FIX(year) : Qnil;
}