Class: RubyToBlock::Character
- Inherits:
-
Object
- Object
- RubyToBlock::Character
- Defined in:
- app/models/concerns/ruby_to_block.rb
Overview
ソースコードに含まれるキャラクターを表現するクラス
Instance Attribute Summary collapse
-
#angle ⇒ Object
Returns the value of attribute angle.
-
#costumes ⇒ Object
Returns the value of attribute costumes.
-
#name ⇒ Object
Returns the value of attribute name.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(options) ⇒ Character
constructor
A new instance of Character.
- #to_xml(parent) ⇒ Object
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() @name = [:name] @costumes = [:costumes] @x = [:x] @y = [:y] @angle = [:angle] end |
Instance Attribute Details
#angle ⇒ Object
Returns the value of attribute angle.
231 232 233 |
# File 'app/models/concerns/ruby_to_block.rb', line 231 def angle @angle end |
#costumes ⇒ Object
Returns the value of attribute costumes.
228 229 230 |
# File 'app/models/concerns/ruby_to_block.rb', line 228 def costumes @costumes end |
#name ⇒ Object
Returns the value of attribute name.
227 228 229 |
# File 'app/models/concerns/ruby_to_block.rb', line 227 def name @name end |
#x ⇒ Object
Returns the value of attribute x.
229 230 231 |
# File 'app/models/concerns/ruby_to_block.rb', line 229 def x @x end |
#y ⇒ Object
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 |