Class: LensProtocol::OMA::Line

Inherits:
Struct
  • Object
show all
Defined in:
lib/lens_protocol/oma/line.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



3
4
5
# File 'lib/lens_protocol/oma/line.rb', line 3

def data
  @data
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



3
4
5
# File 'lib/lens_protocol/oma/line.rb', line 3

def label
  @label
end

#rawObject

Returns the value of attribute raw

Returns:

  • (Object)

    the current value of raw



3
4
5
# File 'lib/lens_protocol/oma/line.rb', line 3

def raw
  @raw
end

Class Method Details

.parse(raw_line) ⇒ Object

Raises:



4
5
6
7
8
9
# File 'lib/lens_protocol/oma/line.rb', line 4

def self.parse raw_line
  raise ParsingError.new('The label separator is missing', raw_line) unless raw_line.include?('=')

  label, data = raw_line.split('=', -1)
  Line.new label: label, data: data, raw: raw_line
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/lens_protocol/oma/line.rb', line 11

def to_s
  "#{label}=#{data}"
end