Class: Teleinfo::Frame
- Inherits:
-
Object
- Object
- Teleinfo::Frame
- Defined in:
- lib/teleinfo/frame.rb
Overview
Take an array of String to parse as a Téléinfo Frame
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(lines) ⇒ Frame
constructor
A new instance of Frame.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(lines) ⇒ Frame
Returns a new instance of Frame.
6 7 8 9 |
# File 'lib/teleinfo/frame.rb', line 6 def initialize(lines) fail ArgumentError.new('Must instanciate with a non empty array of String') if !lines.is_a?(Array) || lines.empty? || lines.any? { |line| !line.is_a?(String) } tokenize(lines) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/teleinfo/frame.rb', line 4 def errors @errors end |
Instance Method Details
#to_hash ⇒ Object
11 12 13 |
# File 'lib/teleinfo/frame.rb', line 11 def to_hash @data end |
#to_json ⇒ Object
15 16 17 |
# File 'lib/teleinfo/frame.rb', line 15 def to_json @data.to_json end |