Class: FAFuse::User

Inherits:
Object
  • Object
show all
Defined in:
lib/fafuse/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ User

Returns a new instance of User.



12
13
14
15
16
# File 'lib/fafuse/user.rb', line 12

def initialize(path)
  @path = path
  @slug = User.match?(path)[1]
  @resource = RestClient::Resource.new("http://www.furaffinity.net/user/")
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/fafuse/user.rb', line 6

def path
  @path
end

#slugObject

Returns the value of attribute slug.



6
7
8
# File 'lib/fafuse/user.rb', line 6

def slug
  @slug
end

Class Method Details

.match?(path) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/fafuse/user.rb', line 8

def self.match?(path)
  path.match(/^\/([^\.][^\/]+)$/)
end

Instance Method Details

#contentObject



36
37
38
# File 'lib/fafuse/user.rb', line 36

def content
  [ "metadata.json", "gallery" ]
end

#exists?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/fafuse/user.rb', line 22

def exists?
  Helpers::fa_is_valid?(document)
end

#statObject



26
27
28
29
30
31
32
33
34
# File 'lib/fafuse/user.rb', line 26

def stat
  return RFuse::Stat.directory(0555, {
                                 :uid => 0,
                                 :gid => 0,
                                 :atime => Time.now,
                                 :mtime => Time.now,
                                 :size => 0
                               })
end

#valid?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/fafuse/user.rb', line 18

def valid?
  !!slug && slug[0] != "." && exists?
end