Class: IntacctRuby::Functions::BaseFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/intacct_ruby/functions/base_function.rb

Overview

Creates the basic structure for all functions. Meant to be an interface: this should not be implemented on its own.

Instance Method Summary collapse

Constructor Details

#initialize(controlid, attrs = {}) ⇒ BaseFunction

Returns a new instance of BaseFunction.



8
9
10
11
12
13
# File 'lib/intacct_ruby/functions/base_function.rb', line 8

def initialize(controlid, attrs = {})
  @controlid = controlid
  @attrs = attrs

  @xml = Builder::XmlMarkup.new
end

Instance Method Details

#to_xmlObject



15
16
17
18
19
20
21
22
# File 'lib/intacct_ruby/functions/base_function.rb', line 15

def to_xml
  @xml.function controlid: @controlid do
    yield(@xml)
  end

  # converts xml to string
  @xml.target!
end