Class: Viberator
- Inherits:
-
Object
- Object
- Viberator
- Defined in:
- lib/viberator.rb,
lib/viberator/cli.rb,
lib/viberator/chat.rb,
lib/viberator/event.rb,
lib/viberator/author.rb,
lib/viberator/record.rb,
lib/viberator/writer.rb,
lib/viberator/version.rb,
lib/viberator/database.rb
Defined Under Namespace
Classes: Author, CLI, Chat, Database, Event, Record, Writer
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Method Summary collapse
- #databases ⇒ Object
-
#initialize(path) ⇒ Viberator
constructor
A new instance of Viberator.
- #sticker(id) ⇒ Object
Constructor Details
#initialize(path) ⇒ Viberator
Returns a new instance of Viberator.
9 10 11 12 |
# File 'lib/viberator.rb', line 9 def initialize(path) @path = Pathname.new(path).realpath @stickers = Pathname.glob(@path.join "data/stickers/60/**/*.png").freeze end |
Instance Method Details
#databases ⇒ Object
14 15 16 17 18 |
# File 'lib/viberator.rb', line 14 def databases @path.children .select { |p| p.directory? && p.join("viber.db").exist? } .map { |p| Database.new(self, p) } end |
#sticker(id) ⇒ Object
20 21 22 |
# File 'lib/viberator.rb', line 20 def sticker(id) @stickers.find { |p| p.to_s =~ /\/0*#{id}.png$/ } end |