Sha256: c714e5e0556f9c7e71c3ef8247152fcbcb143d0e15bd129de13198c77fd8c0c9

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

class Artist

  attr_accessor :stage_name

  def initialize(name, attrs)
    @name = name
    @attrs = attrs
    @stage_name = attrs[:stage_name]
  end

  def starve
    Song.produce(10)
  end
end

class Singer < Artist

  SUPER_ATTRS = { singing: 10, dancing: 10, looks: 10 }
  HIPSTER_THRESHOLD = 10

  class << self
    def sellouts
      where(:album_sales > HIPSTER_THRESHOLD)
    end
  end

  def self.superstar
    first = %w[Michael Beyonce Cee-lo Devin]
    last = %w[Jackson Knowles Green Townsend]
    new("#{first.sample} #{last.sample}", SUPER_ATTRS.dup)
  end

  def status
    if self.album_sales > HIPSTER_THRESHOLD
      "sellout"
    else
      "cool"
    end
  end

  def songs
    Song.where(artist: self)
  end

  def sing
    mic = Performance::Equipment::Microphone
    mic.shout "♬ Hang the DJ! ♬"
  end
end

class Song

  def initialize(popularity)
    @popularity = popularity
  end
end

module Instruments

  class Stringed

    def initialize(num_strings)
      @num_strings = num_strings
    end
  end

  class Guitar < Stringed

    def initialize(sound)
      super(6)
      @sound = sound
    end
  end

end

module Performances
  module Equipment
    class Amp
    end

    class Microphone
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
analyst-0.16.1 spec/fixtures/music.rb
analyst-0.15.0 spec/fixtures/music.rb