class CanFrameSet

Attributes

frames[R]

Public Class Methods

new(frames) click to toggle source
# File lib/retrotoolkit/can_frame_set.rb, line 5
def initialize frames
  @frames = frames
end

Public Instance Methods

find_by_identifier(identifier) click to toggle source
# File lib/retrotoolkit/can_frame_set.rb, line 17
def find_by_identifier identifier
  @frames.select { |f| f.identifier == identifier }
end
find_by_value(value) click to toggle source
# File lib/retrotoolkit/can_frame_set.rb, line 21
def find_by_value value
  @frames.select { |f| f.match(value) }
end
formatted_output() click to toggle source
# File lib/retrotoolkit/can_frame_set.rb, line 29
def formatted_output
  @frames.map { |f| f.formatted_output }.join("\n")
end
identifiers() click to toggle source
# File lib/retrotoolkit/can_frame_set.rb, line 9
def identifiers
  identifiers = []
  @frames.each do |f|
    identifiers << f.identifier unless identifiers.include?(f.identifier)
  end
  identifiers
end
match_identifier_with_value(id, value) click to toggle source
# File lib/retrotoolkit/can_frame_set.rb, line 25
def match_identifier_with_value id, value
  find_by_value(value) & find_by_identifier(id)
end
write(file) click to toggle source
# File lib/retrotoolkit/can_frame_set.rb, line 33
def write file
  File.open file, 'w' do |f|
    f.write formatted_output
  end  
end