class Fushin::Item

Attributes

title[R]

Public Class Methods

new(title:, link:) click to toggle source
# File lib/fushin/item.rb, line 7
def initialize(title:, link:)
  @title = title
  @link = link
end

Public Instance Methods

post() click to toggle source
# File lib/fushin/item.rb, line 12
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