-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
155 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'active_support/concern' | ||
require 'weka/core/serialization_helper' | ||
|
||
module Weka | ||
module Concerns | ||
module Serializable | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
def serialize(filename) | ||
Weka::Core::SerializationHelper.write(filename, self) | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Weka | ||
module Core | ||
java_import 'weka.core.SerializationHelper' | ||
|
||
class SerializationHelper | ||
|
||
class << self | ||
alias :deserialize :read | ||
alias :serialize :write | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Weka | ||
VERSION = "0.1.0" | ||
VERSION = "0.2.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'spec_helper' | ||
|
||
describe Weka::Concerns::Serializable do | ||
|
||
subject do | ||
Class.new { include Weka::Concerns::Serializable } | ||
end | ||
|
||
let(:filename) { 'file.model' } | ||
|
||
it 'should respond to #serialize' do | ||
expect(subject.new).to respond_to :serialize | ||
end | ||
|
||
describe '#serialize' do | ||
it 'should call Weka::Core::SerializationHelper.write' do | ||
expect(Weka::Core::SerializationHelper) | ||
.to receive(:write) | ||
.with(filename, subject) | ||
|
||
subject.new.serialize(filename) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'spec_helper' | ||
|
||
describe Weka::Core::SerializationHelper do | ||
|
||
it { is_expected.to be_kind_of Java::WekaCore::SerializationHelper } | ||
|
||
describe 'aliases:' do | ||
{ | ||
write: :serialize, | ||
read: :deserialize | ||
}.each do |method, alias_method| | ||
it "should define the alias .#{alias_method} for .#{method}" do | ||
expect(Weka::Core::SerializationHelper.public_class_method(method)) | ||
.to eq Weka::Core::SerializationHelper.public_class_method(alias_method) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters