Sha256: 50195b678f5c9c3884c51be3f9358d271f074be9a96b7bc36222cd9cc1ec2b88
Contents?: true
Size: 1.13 KB
Versions: 10
Compression:
Stored size: 1.13 KB
Contents
require "ecu/version" require "ecu/signals" require "ecu/labels" class Ecu attr_reader :name, :signals, :labels def initialize(name:, signals: SignalList.new([]), labels: LabelList.new([]), **hsh) @name = name @signals = case signals when String then SignalList.from_file(signals) when SignalList then signals else raise "Unknown signals format" end @labels = case labels when String then LabelList.from_file(labels) when LabelList then labels else raise "Unknown labels format" end @hsh = hsh end def is_can? name[-3..-1] == "CAN" end def shortname name.sub(/:.*/, "") end def to_s name end def inspect "<Ecu: #{name}>" end def ==(other) self.to_s == other.to_s end def eql?(other) self == other end def hash name.hash end def method_missing(m, *args, &block) @hsh.fetch(m) do raise ArgumentError.new("Cannot find property #{m}") end end def respond_to?(m, include_all=false) @hsh.keys.include?(m) end end
Version data entries
10 entries across 10 versions & 1 rubygems