Module: XamplExample::EmphAsChild

Included in:
Description
Defined in:
lib/xamplr/handwritten/hand-example.rb,
lib/xamplr/handwritten/example.rb

Overview

<things>

<thing pid=''>

<description kind=”>blah <emph>blah</emph> blah</description> <keyValue id=” value=”/> <stuff kind=”/> <thing pid=”/> <things/> </thing> </things>

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#emph_childObject

Returns the value of attribute emph_child.



113
114
115
# File 'lib/xamplr/handwritten/example.rb', line 113

def emph_child
  @emph_child
end

Instance Method Details

#add_emph(emph) ⇒ Object



119
120
121
122
123
124
125
# File 'lib/xamplr/handwritten/example.rb', line 119

def add_emph(emph)
  @children << emph
  @emph_child << emph
  emph.add_parent(self)
  changed
  return emph
end

#init_emph_as_childObject



115
116
117
# File 'lib/xamplr/handwritten/example.rb', line 115

def init_emph_as_child
  @emph_child = []
end

#new_emph {|emph| ... } ⇒ Object

Yields:

  • (emph)


127
128
129
130
131
# File 'lib/xamplr/handwritten/example.rb', line 127

def new_emph
  emph = Emph.new
  yield(emph) if block_given?
  return add_emph(emph)
end

#remove_emph(emph) ⇒ Object



133
134
135
136
# File 'lib/xamplr/handwritten/example.rb', line 133

def remove_emph(emph)
  @emph_child.delete(emph)
  @children.delete(emph)
end