class Xapi::InteractionComponent
InteractionComponent
Class Description
Attributes
description[RW]
id[RW]
Public Class Methods
new(options={}, &block)
click to toggle source
# File lib/xapi/interaction_component.rb, line 8 def initialize(options={}, &block) json = options.fetch(:json, nil) if json attributes = JSON.parse(json) self.id = attributes['id'] if attributes['id'] self.description = attributes['description'] if attributes['description'] else self.id = options.fetch(:id, nil) self.description = options.fetch(:description, nil) if block_given? block[self] end end end
Public Instance Methods
serialize(version)
click to toggle source
# File lib/xapi/interaction_component.rb, line 24 def serialize(version) node = {} node['id'] = id if id node['description'] = description if description node end