Class: TmxParser::Placeholder

Inherits:
Object
  • Object
show all
Defined in:
lib/tmx-parser/elements.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, text = '') ⇒ Placeholder

Returns a new instance of Placeholder.



91
92
93
94
# File 'lib/tmx-parser/elements.rb', line 91

def initialize(type, text = '')
  @type = type
  @text = text
end

Instance Attribute Details

#lengthObject

Returns the value of attribute length.



89
90
91
# File 'lib/tmx-parser/elements.rb', line 89

def length
  @length
end

#startObject

Returns the value of attribute start.



89
90
91
# File 'lib/tmx-parser/elements.rb', line 89

def start
  @start
end

#textObject (readonly)

Returns the value of attribute text.



88
89
90
# File 'lib/tmx-parser/elements.rb', line 88

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



88
89
90
# File 'lib/tmx-parser/elements.rb', line 88

def type
  @type
end

Instance Method Details

#==(other_placeholder) ⇒ Object



107
108
109
110
111
112
# File 'lib/tmx-parser/elements.rb', line 107

def ==(other_placeholder)
  type == other_placeholder.type &&
    text == other_placeholder.type &&
    start == other_placeholder.start &&
    length == other_placeholder.length
end

#copyObject



100
101
102
103
104
105
# File 'lib/tmx-parser/elements.rb', line 100

def copy
  self.class.new(type.dup, text.dup).tap do |new_placeholder|
    new_placeholder.start = start  # can't dup fixnums
    new_placeholder.length = length
  end
end

#receive_text(str) ⇒ Object



96
97
98
# File 'lib/tmx-parser/elements.rb', line 96

def receive_text(str)
  @text << str
end