class Gotaku::Question

Constants

FORMAT
LENGTH

Attributes

choices[R]
genre[R]
index[R]
message[R]

Public Class Methods

new(&block) click to toggle source
# File lib/gotaku/question.rb, line 19
def initialize(&block)
  instance_eval(&block) if block_given?
end
parse(bulk, options = {}) click to toggle source
# File lib/gotaku/question.rb, line 6
def self.parse(bulk, options = {})
  new do
    @data = (bulk ? Util.decode(bulk).unpack(FORMAT) : [])
    @data = @data.map {|l| l.toutf8.strip}
    @message = @data.first
    @choices = @data[1..-1]
    @genre = options[:genre]
    @index = options[:index]
  end
end