Skip to content

Commit 3564da1

Browse files
committed
Merge pull request #25 from codeworm96/ascii_art
Wrap SymEngine::ascii_art() and replace the current function
2 parents 014a7ee + ab343b9 commit 3564da1

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

ext/symengine/symengine.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <symengine/cwrapper.h>
12
#include "ruby_basic.h"
23
#include "ruby_symbol.h"
34
#include "ruby_integer.h"
@@ -9,8 +10,16 @@
910
// Ruby Bindings //
1011
///////////////////
1112

13+
VALUE msymengine_ascii_art(VALUE self) {
14+
char* str = ascii_art_str();
15+
VALUE ascii_art = rb_str_new_cstr(str);
16+
basic_str_free(str);
17+
return ascii_art;
18+
}
19+
1220
void Init_symengine() {
1321
m_symengine = rb_define_module("SymEngine");
22+
rb_define_singleton_method(m_symengine, "ascii_art", msymengine_ascii_art, 0);
1423

1524
//Basic class
1625
c_basic = rb_define_class_under(m_symengine, "Basic", rb_cObject);

lib/symengine.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
require 'symengine/symengine'
22
require 'symengine/iruby'
33
require 'symengine/basic'
4-
5-
module SymEngine
6-
def SymEngine.ascii_art
7-
puts "
8-
_____ _____ _
9-
| __|_ _ _____| __|___ ___|_|___ ___
10-
|__ | | | | __| | . | | | -_|
11-
|_____|_ |_|_|_|_____|_|_|_ |_|_|_|___|
12-
|___| |___| "
13-
end
14-
end

spec/symengine_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require 'spec_helper'
2+
3+
describe SymEngine do
4+
describe 'ascii_art' do
5+
it 'should return a non-zero length string' do
6+
assert SymEngine.ascii_art.length > 0
7+
end
8+
end
9+
end

symengine_version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f6f1c89bde0d12ba718a9aeddcdf630f36893756
1+
668cf3a16f7c3a162727a8ffd6776e84dca78a41

0 commit comments

Comments
 (0)