Class: Session

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ Session

Returns a new instance of Session.



314
315
316
# File 'lib/ft_42.rb', line 314

def initialize(session)
  @session = session
end

Instance Attribute Details

#sessionObject (readonly)

Returns the value of attribute session.



312
313
314
# File 'lib/ft_42.rb', line 312

def session
  @session
end

Instance Method Details

#begin_atObject



318
319
320
# File 'lib/ft_42.rb', line 318

def begin_at
  session["begin_at"].to_time
end

#durationObject



334
335
336
# File 'lib/ft_42.rb', line 334

def duration
  end_at - begin_at unless end_at.nil?
end

#end_atObject



322
323
324
# File 'lib/ft_42.rb', line 322

def end_at
  session["end_at"].to_time unless session["end_at"].nil?
end

#hostObject



326
327
328
# File 'lib/ft_42.rb', line 326

def host
  session["host"]
end

#primary?Boolean

Returns:

  • (Boolean)


330
331
332
# File 'lib/ft_42.rb', line 330

def primary?
  session["primary"]
end