Class: ReadIt::Sub

Inherits:
Object
  • Object
show all
Defined in:
lib/read_it/sub.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Sub

Returns a new instance of Sub.



5
6
7
# File 'lib/read_it/sub.rb', line 5

def initialize name
  @name = "/r/#{name}"
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/read_it/sub.rb', line 3

def name
  @name
end

Instance Method Details

#recentObject



9
10
11
# File 'lib/read_it/sub.rb', line 9

def recent
  Post.parse ReadIt.http.get "#{name}/new.json"
end

#sampleObject



13
14
15
# File 'lib/read_it/sub.rb', line 13

def sample
  recent.sample
end