Method: RubySpeech::GenericElement#read_attr

Defined in:
lib/ruby_speech/generic_element.rb

#read_attr(attr_name, to_call = nil) ⇒ Object

Helper method to read an attribute

the returned value

Parameters:

  • attr_name (#to_sym)

    the name of the attribute

  • to_call (String, Symbol, nil) (defaults to: nil)

    the name of the method to call on

Returns:

  • nil or the value



193
194
195
196
# File 'lib/ruby_speech/generic_element.rb', line 193

def read_attr(attr_name, to_call = nil)
  val = self[attr_name]
  val && to_call ? val.__send__(to_call) : val
end