Skip to content

Commit

Permalink
Merge pull request #114 from Prakriti-nith/rename_datatables
Browse files Browse the repository at this point in the history
Rename Daru::DataTables::DataTable to Daru::View::DataTable
  • Loading branch information
Shekharrajak authored Aug 23, 2018
2 parents 92263f4 + 8882656 commit caa71dd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
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'
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

0 comments on commit caa71dd

Please sign in to comment.