Class: Midos::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/midos/base.rb

Direct Known Subclasses

Reader, Writer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, &block) ⇒ Base

Returns a new instance of Base.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/midos/base.rb', line 52

def initialize(options = {}, &block)
  self.key = options[:key]

  self.rs = options.fetch(:rs, DEFAULT_RS)
  self.fs = options.fetch(:fs, DEFAULT_FS)
  self.vs = options.fetch(:vs, DEFAULT_VS)
  self.nl = options.fetch(:nl, DEFAULT_NL)
  self.le = options.fetch(:le, DEFAULT_LE)
  self.io = options.fetch(:io, self.class::DEFAULT_IO)

  @auto_id_block = options.fetch(:auto_id, block)

  reset
end

Instance Attribute Details

#auto_idObject

Returns the value of attribute auto_id.



67
68
69
# File 'lib/midos/base.rb', line 67

def auto_id
  @auto_id
end

#fsObject

Returns the value of attribute fs.



67
68
69
# File 'lib/midos/base.rb', line 67

def fs
  @fs
end

#ioObject

Returns the value of attribute io.



67
68
69
# File 'lib/midos/base.rb', line 67

def io
  @io
end

#keyObject

Returns the value of attribute key.



67
68
69
# File 'lib/midos/base.rb', line 67

def key
  @key
end

#leObject

Returns the value of attribute le.



67
68
69
# File 'lib/midos/base.rb', line 67

def le
  @le
end

#nlObject

Returns the value of attribute nl.



67
68
69
# File 'lib/midos/base.rb', line 67

def nl
  @nl
end

#rsObject

Returns the value of attribute rs.



67
68
69
# File 'lib/midos/base.rb', line 67

def rs
  @rs
end

#vsObject (readonly)

Returns the value of attribute vs.



69
70
71
# File 'lib/midos/base.rb', line 69

def vs
  @vs
end

Instance Method Details

#resetObject



71
72
73
# File 'lib/midos/base.rb', line 71

def reset
  @auto_id = @auto_id_block ? @auto_id_block.call : default_auto_id
end