Class: Fushin::Item
- Inherits:
-
Object
- Object
- Fushin::Item
- Defined in:
- lib/fushin/item.rb
Instance Attribute Summary collapse
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title:, link:) ⇒ Item
constructor
A new instance of Item.
- #post ⇒ Object
Constructor Details
#initialize(title:, link:) ⇒ Item
Returns a new instance of Item.
7 8 9 10 |
# File 'lib/fushin/item.rb', line 7 def initialize(title:, link:) @title = title @link = link end |
Instance Attribute Details
#link ⇒ Object (readonly)
Returns the value of attribute link.
5 6 7 |
# File 'lib/fushin/item.rb', line 5 def link @link end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/fushin/item.rb', line 5 def title @title end |
Instance Method Details
#post ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 |