Sha256: ba6acbe8c4e92faf4365d195a5f15fb21046fd9803d4d3f49027a110fe62f15c

Contents?: true

Size: 666 Bytes

Versions: 7

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

module Fushin
  class Item
    attr_reader :title, :link

    def initialize(title:, link:)
      @title = title
      @link = link
    end

    def post
      @post ||= [].tap do |out|
        case link
        when /jugem\.jp/
          out << Posts::Jugem.new(link)
        when /kikey\.net/
          out << Posts::Kikey.new(link)
        when /seesaa\.net/
          out << Posts::Seesaa.new(link)
        when /shinobi\.jp/
          out << Posts::Shinobi.new(link)
        when /teacup\.com/
          out << Posts::Teacup.new(link)
        else
          raise NoMachingPostsError
        end
      end.first
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fushin-0.3.4 lib/fushin/item.rb
fushin-0.3.3 lib/fushin/item.rb
fushin-0.3.2 lib/fushin/item.rb
fushin-0.3.1 lib/fushin/item.rb
fushin-0.3.0 lib/fushin/item.rb
fushin-0.2.0 lib/fushin/item.rb
fushin-0.1.1 lib/fushin/item.rb