Sha256: 0cd86f02947a4463875bf3621a0aba6d9e8656ba9afbcd948b385af5dcf8d2ed

Contents?: true

Size: 1.46 KB

Versions: 7

Compression:

Stored size: 1.46 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
      include Interfaces::Basic
      def self.companion_gear(type)
        [
          Performances::Equipment::Microphone.new("mic_1").on,
          Performances::Equipment::MicStand.new("mic_1_stand")
        ]
      end
    end

    class Microphone
    end

    class MicStand
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
analyst-1.2.4 spec/fixtures/music/music.rb
analyst-1.2.3 spec/fixtures/music/music.rb
analyst-1.2.2 spec/fixtures/music/music.rb
analyst-1.2.1 spec/fixtures/music/music.rb
analyst-1.2.0 spec/fixtures/music/music.rb
analyst-1.0.1 spec/fixtures/music.rb
analyst-1.0.0 spec/fixtures/music.rb