Class: CRFPP::Model

Inherits:
Object
  • Object
show all
Includes:
Filelike
Defined in:
lib/crfpp/model.rb

Instance Attribute Summary collapse

Attributes included from Filelike

#path

Instance Method Summary collapse

Methods included from Filelike

#read, #write

Constructor Details

#initialize(path = nil) ⇒ Model

Returns a new instance of Model.



8
9
10
# File 'lib/crfpp/model.rb', line 8

def initialize(path = nil)
  @data, @path = '', path
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/crfpp/model.rb', line 6

def data
  @data
end

Instance Method Details

#openObject



12
13
14
15
# File 'lib/crfpp/model.rb', line 12

def open
  @data = read
  self
end

#saveObject



17
18
19
20
# File 'lib/crfpp/model.rb', line 17

def save
  write(@data)
  self
end