Sha256: 599ab3307e32b622ff4428edc1ea6f56201978f2f4504ad0dc74d07d663e36d6

Contents?: true

Size: 729 Bytes

Versions: 3

Compression:

Stored size: 729 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)
        when /sblo\.jp/
          out << Posts::Sblo.new(link)
        else
          raise NoMachingPostsError
        end
      end.first
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fushin-0.4.2 lib/fushin/item.rb
fushin-0.4.1 lib/fushin/item.rb
fushin-0.4.0 lib/fushin/item.rb