ntcharts 0.1.0-arm-linux-musl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/ntcharts.rb ADDED
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "ntcharts/version"
4
+
5
+ begin
6
+ major, minor, _patch = RUBY_VERSION.split(".")
7
+ require_relative "ntcharts/#{major}.#{minor}/ntcharts"
8
+ rescue LoadError
9
+ require_relative "ntcharts/ntcharts"
10
+ end
11
+
12
+ require_relative "ntcharts/bar_data"
13
+
14
+ module Ntcharts
15
+ class Error < StandardError; end
16
+
17
+ # Helper method to convert Lipgloss::Style to Ntcharts::Style
18
+ # This allows using Lipgloss::Style objects directly with ntcharts
19
+ def self.convert_style(style)
20
+ return style if style.is_a?(Ntcharts::Style)
21
+
22
+ raise ArgumentError, "Expected Ntcharts::Style or Lipgloss::Style, got #{style.class}" unless style.respond_to?(:get_foreground) && style.respond_to?(:get_background) && style.respond_to?(:bold?)
23
+
24
+ ntcharts_style = Ntcharts::Style.new
25
+
26
+ fg = style.get_foreground
27
+ bg = style.get_background
28
+
29
+ ntcharts_style = ntcharts_style.foreground(fg) if fg
30
+ ntcharts_style = ntcharts_style.background(bg) if bg
31
+ ntcharts_style = ntcharts_style.bold(style.bold?) if style.bold?
32
+
33
+ ntcharts_style
34
+ end
35
+
36
+ module StyleSetters
37
+ def style=(value)
38
+ _set_style(Ntcharts.convert_style(value))
39
+ end
40
+
41
+ def axis_style=(value)
42
+ _set_axis_style(Ntcharts.convert_style(value))
43
+ end
44
+
45
+ def label_style=(value)
46
+ _set_label_style(Ntcharts.convert_style(value))
47
+ end
48
+ end
49
+
50
+ class Barchart
51
+ include StyleSetters
52
+
53
+ def push(bar_data)
54
+ data = case bar_data
55
+ when BarData then bar_data
56
+ when Hash then BarData.new(**bar_data)
57
+ else raise ArgumentError, "Expected BarData or Hash"
58
+ end
59
+
60
+ _push(data)
61
+
62
+ self
63
+ end
64
+
65
+ def push_all(bar_data_array)
66
+ data = bar_data_array.map do |d|
67
+ case d
68
+ when BarData then d
69
+ when Hash then BarData.new(**d)
70
+ else raise ArgumentError, "Expected BarData or Hash"
71
+ end
72
+ end
73
+ _push_all(data)
74
+ self
75
+ end
76
+
77
+ def render
78
+ draw
79
+ view
80
+ end
81
+ end
82
+
83
+ class Sparkline
84
+ include StyleSetters
85
+ end
86
+
87
+ class Linechart
88
+ include StyleSetters
89
+ end
90
+
91
+ class Wavelinechart
92
+ include StyleSetters
93
+ end
94
+
95
+ class Streamlinechart
96
+ include StyleSetters
97
+ end
98
+
99
+ class Timeserieslinechart
100
+ include StyleSetters
101
+ end
102
+ end
data/ntcharts.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/ntcharts/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ntcharts"
7
+ spec.version = Ntcharts::VERSION
8
+ spec.authors = ["Marco Roth"]
9
+ spec.email = ["marco.roth@intergga.ch"]
10
+
11
+ spec.summary = "Ruby wrapper for NimbleMarkets' ntcharts terminal charting library."
12
+ spec.description = spec.summary
13
+ spec.homepage = "https://github.com/marcoroth/ntcharts-ruby"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.2.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/marcoroth/ntcharts-ruby"
19
+ spec.metadata["changelog_uri"] = "https://github.com/marcoroth/ntcharts-ruby/releases"
20
+ spec.metadata["rubygems_mfa_required"] = "true"
21
+
22
+ spec.files = Dir[
23
+ "ntcharts.gemspec",
24
+ "LICENSE.txt",
25
+ "README.md",
26
+ "lib/**/*.rb",
27
+ "ext/**/*.{c,h,rb}",
28
+ "go/**/*.{go,mod,sum}",
29
+ "go/build/**/*"
30
+ ]
31
+
32
+ spec.require_paths = ["lib"]
33
+ spec.extensions = ["ext/ntcharts/extconf.rb"]
34
+
35
+ spec.add_dependency "rake-compiler", "~> 1.2"
36
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ntcharts
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: arm-linux-musl
6
+ authors:
7
+ - Marco Roth
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rake-compiler
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.2'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.2'
26
+ description: Ruby wrapper for NimbleMarkets' ntcharts terminal charting library.
27
+ email:
28
+ - marco.roth@intergga.ch
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - README.md
34
+ - ext/ntcharts/barchart.c
35
+ - ext/ntcharts/extconf.rb
36
+ - ext/ntcharts/extension.c
37
+ - ext/ntcharts/extension.h
38
+ - ext/ntcharts/linechart.c
39
+ - ext/ntcharts/sparkline.c
40
+ - ext/ntcharts/streamlinechart.c
41
+ - ext/ntcharts/style.c
42
+ - ext/ntcharts/timeserieslinechart.c
43
+ - ext/ntcharts/wavelinechart.c
44
+ - go/barchart.go
45
+ - go/build/linux_arm/libntcharts.a
46
+ - go/build/linux_arm/libntcharts.h
47
+ - go/go.mod
48
+ - go/go.sum
49
+ - go/linechart.go
50
+ - go/ntcharts.go
51
+ - go/sparkline.go
52
+ - go/streamlinechart.go
53
+ - go/timeserieslinechart.go
54
+ - go/wavelinechart.go
55
+ - lib/ntcharts.rb
56
+ - lib/ntcharts/3.2/ntcharts.so
57
+ - lib/ntcharts/3.3/ntcharts.so
58
+ - lib/ntcharts/3.4/ntcharts.so
59
+ - lib/ntcharts/4.0/ntcharts.so
60
+ - lib/ntcharts/bar_data.rb
61
+ - lib/ntcharts/version.rb
62
+ - ntcharts.gemspec
63
+ homepage: https://github.com/marcoroth/ntcharts-ruby
64
+ licenses:
65
+ - MIT
66
+ metadata:
67
+ homepage_uri: https://github.com/marcoroth/ntcharts-ruby
68
+ source_code_uri: https://github.com/marcoroth/ntcharts-ruby
69
+ changelog_uri: https://github.com/marcoroth/ntcharts-ruby/releases
70
+ rubygems_mfa_required: 'true'
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '3.2'
79
+ - - "<"
80
+ - !ruby/object:Gem::Version
81
+ version: 4.1.dev
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 3.3.22
87
+ requirements: []
88
+ rubygems_version: 4.0.3
89
+ specification_version: 4
90
+ summary: Ruby wrapper for NimbleMarkets' ntcharts terminal charting library.
91
+ test_files: []