Class: RubyToBlock::Character

Inherits:
Object
  • Object
show all
Defined in:
app/models/concerns/ruby_to_block.rb

Overview

ソースコードに含まれるキャラクターを表現するクラス

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Character

Returns a new instance of Character.



233
234
235
236
237
238
239
# File 'app/models/concerns/ruby_to_block.rb', line 233

def initialize(options)
  @name = options[:name]
  @costumes = options[:costumes]
  @x = options[:x]
  @y = options[:y]
  @angle = options[:angle]
end

Instance Attribute Details

#angleObject

Returns the value of attribute angle.



231
232
233
# File 'app/models/concerns/ruby_to_block.rb', line 231

def angle
  @angle
end

#costumesObject

Returns the value of attribute costumes.



228
229
230
# File 'app/models/concerns/ruby_to_block.rb', line 228

def costumes
  @costumes
end

#nameObject

Returns the value of attribute name.



227
228
229
# File 'app/models/concerns/ruby_to_block.rb', line 227

def name
  @name
end

#xObject

Returns the value of attribute x.



229
230
231
# File 'app/models/concerns/ruby_to_block.rb', line 229

def x
  @x
end

#yObject

Returns the value of attribute y.



230
231
232
# File 'app/models/concerns/ruby_to_block.rb', line 230

def y
  @y
end

Instance Method Details

#to_xml(parent) ⇒ Object



241
242
243
244
245
246
# File 'app/models/concerns/ruby_to_block.rb', line 241

def to_xml(parent)
  parent.add_element('character',
                     'name' => @name,
                     'x' => @x, 'y' => @y, 'angle' => @angle,
                     'costumes' => @costumes.join(','))
end