Class: CiPower::Communication

Inherits:
Record
  • Object
show all
Defined in:
lib/ci_power/communication.rb

Instance Attribute Summary collapse

Attributes inherited from Record

#address_identification_debtee, #address_identification_debtor, #group_no, #record_type

Instance Method Summary collapse

Methods inherited from Record

#cip_default_data, #fill_up, #line_terminator

Constructor Details

#initialize(attributes = {}) ⇒ Communication

Returns a new instance of Communication.



6
7
8
9
10
11
12
13
# File 'lib/ci_power/communication.rb', line 6

def initialize(attributes = {})
  if attributes.is_a? Hash
    attributes.merge! :record_type => '02'
    attributes.each do |key, value|
      self.send("#{key}=".to_sym, value) if self.respond_to?("#{key}=")
    end
  end
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/ci_power/communication.rb', line 3

def text
  @text
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/ci_power/communication.rb', line 3

def type
  @type
end

Instance Method Details

#to_cip(with_line_terminator = true) ⇒ Object



15
16
17
# File 'lib/ci_power/communication.rb', line 15

def to_cip(with_line_terminator = true)
  cip_default_data << fill_up({:type => 10, :text => 32}, with_line_terminator)
end