Class: Bismas::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bismas/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.



49
50
51
52
53
54
55
56
57
# File 'lib/bismas/base.rb', line 49

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

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

  reset
end

Instance Attribute Details

#auto_idObject

Returns the value of attribute auto_id.



59
60
61
# File 'lib/bismas/base.rb', line 59

def auto_id
  @auto_id
end

#ioObject

Returns the value of attribute io.



59
60
61
# File 'lib/bismas/base.rb', line 59

def io
  @io
end

#keyObject

Returns the value of attribute key.



59
60
61
# File 'lib/bismas/base.rb', line 59

def key
  @key
end

Instance Method Details

#resetObject



61
62
63
# File 'lib/bismas/base.rb', line 61

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