Class: Extface::Driver::EltradeTmU220::Frame
- Inherits:
-
Object
- Object
- Extface::Driver::EltradeTmU220::Frame
- Includes:
- ActiveModel::Validations
- Defined in:
- app/models/extface/driver/eltrade_tm_u220.rb
Instance Attribute Summary collapse
-
#addr ⇒ Object
readonly
Returns the value of attribute addr.
-
#check_sum ⇒ Object
readonly
Returns the value of attribute check_sum.
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#frame ⇒ Object
readonly
Returns the value of attribute frame.
-
#len ⇒ Object
readonly
Returns the value of attribute len.
-
#seq ⇒ Object
readonly
Returns the value of attribute seq.
Instance Method Summary collapse
-
#initialize(buffer) ⇒ Frame
constructor
A new instance of Frame.
- #ready? ⇒ Boolean
Constructor Details
#initialize(buffer) ⇒ Frame
Returns a new instance of Frame.
236 237 238 239 240 241 |
# File 'app/models/extface/driver/eltrade_tm_u220.rb', line 236 def initialize(buffer) if match = buffer.match(/\xAA\x55(.{1})(.{1})(.{1})(.{1})(.*)(.{1})$/nm) @frame = match.to_a.first @addr, @seq, @cmd, @len, @data, @check_sum = match.captures end end |
Instance Attribute Details
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
229 230 231 |
# File 'app/models/extface/driver/eltrade_tm_u220.rb', line 229 def addr @addr end |
#check_sum ⇒ Object (readonly)
Returns the value of attribute check_sum.
229 230 231 |
# File 'app/models/extface/driver/eltrade_tm_u220.rb', line 229 def check_sum @check_sum end |
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
229 230 231 |
# File 'app/models/extface/driver/eltrade_tm_u220.rb', line 229 def cmd @cmd end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
229 230 231 |
# File 'app/models/extface/driver/eltrade_tm_u220.rb', line 229 def data @data end |
#frame ⇒ Object (readonly)
Returns the value of attribute frame.
229 230 231 |
# File 'app/models/extface/driver/eltrade_tm_u220.rb', line 229 def frame @frame end |
#len ⇒ Object (readonly)
Returns the value of attribute len.
229 230 231 |
# File 'app/models/extface/driver/eltrade_tm_u220.rb', line 229 def len @len end |
#seq ⇒ Object (readonly)
Returns the value of attribute seq.
229 230 231 |
# File 'app/models/extface/driver/eltrade_tm_u220.rb', line 229 def seq @seq end |
Instance Method Details
#ready? ⇒ Boolean
243 244 245 |
# File 'app/models/extface/driver/eltrade_tm_u220.rb', line 243 def ready? @ready || true end |