Method: History#initialize

Defined in:
lib/history.rb

#initialize(io = nil, opts = {}) ⇒ History

New History.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/history.rb', line 87

def initialize(io=nil, opts={})
  if Hash === io
    opts = file
    io   = nil
  end

  @releases = []

  case io
  when String
    parse(io)
  when Pathname
    @file = io
    parse(io.read)
  when File
    @file = io.path
    parse(io.read)
  else
    parse(io.read)
  end

  @file = opts[:file] if opts.key?(:file)
end