Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Daru::DataTables::DataTable to Daru::View::DataTable #114

Merged
merged 2 commits into from
Aug 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/daru/view/adapters/datatables.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'daru/data_tables'
require 'daru'
require 'securerandom'
require 'erb'
Expand Down Expand Up @@ -59,13 +58,13 @@ module DatatablesAdapter
# table2 = Daru::View::Table.new(df_sale_exp, options2)
# table3 = Daru::View::Table.new(df_sale_exp)
def init_table(data=[], options={}, _user_options={})
@table = Daru::DataTables::DataTable.new(data, options)
@table = Daru::View::DataTable.new(data, options)
@table
end

# @return [String] returns code of the dependent JS and CSS file(s)
def init_script
Daru::DataTables.init_script
Daru::View::DataTables.init_script
end

# @param table [Daru::DataTables::DataTable] table object to access
Expand Down Expand Up @@ -117,7 +116,7 @@ def generate_html(table)
# table = Daru::View::Table.new(data, options)
# table.init_iruby
def init_iruby
Daru::DataTables.init_iruby
Daru::View::DataTables.init_iruby
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions spec/adapters/datatables_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
let(:table_dv) { Daru::View::Table.new(@data_vec1, @options) }

describe "initialization Tables" do
it "Table class must be Daru::DataTables::DataTable" do
expect(Daru::View::Table.new.table).to be_a Daru::DataTables::DataTable
it "Table class must be Daru::View::DataTable" do
expect(Daru::View::Table.new.table).to be_a Daru::View::DataTable
end

it "Table class must be Daru::DataTables::DataTable when data objects" \
it "Table class must be Daru::View::DataTable when data objects" \
" are of class Array" do
expect(table_string_array.table).to be_a Daru::DataTables::DataTable
expect(table_string_array.table).to be_a Daru::View::DataTable
expect(table_string_array.data).to eq string_array
expect(table_string_array.options).to eq options
end

it "Table class must be Daru::DataTables::DataTable when data objects" \
it "Table class must be Daru::View::DataTable when data objects" \
" are of class Array of Arrays" do
expect(table_array.table).to be_a Daru::DataTables::DataTable
expect(table_array.table).to be_a Daru::View::DataTable
expect(table_array.data).to eq data_array
expect(table_array.options).to eq options
end
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'rspec'
require 'simplecov'
require 'daru/view'
require 'daru/data_tables'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is required to run the specs.

require 'daru'
require 'coveralls'
require 'simplecov-console'
Expand Down
4 changes: 2 additions & 2 deletions spec/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@

it 'daru-data_tables table using DataFrame' do
expect(table_df).to be_a Daru::View::Table
expect(table_df.table).to be_a Daru::DataTables::DataTable
expect(table_df.table).to be_a Daru::View::DataTable
expect(table_df.options).to eq options
expect(table_df.data).to eq df
end

it 'daru-data_tables table using Vector' do
expect(table_dv).to be_a Daru::View::Table
expect(table_dv.table).to be_a Daru::DataTables::DataTable
expect(table_dv.table).to be_a Daru::View::DataTable
expect(table_dv.options).to eq options
expect(table_dv.data).to eq dv
end
Expand Down