diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bbec36..9ffbceb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.0] - 2025-01-21 + +### Added +- Added Zeitwerk inflector configuration for proper constant loading + +### Changed +- Renamed module from `TALib` to `TALibFFI` for better clarity +- Renamed main file from `lib/ta_lib.rb` to `lib/ta_lib_ffi.rb` +- Updated require statements in specs and gemspec + ## [0.1.0] - 2024-01-21 ### Added @@ -26,10 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - N/A -### Fixed -- N/A - ### Security - N/A +[0.2.0]: https://github.com/Youngv/ta_lib_ffi/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/Youngv/ta_lib_ffi/releases/tag/v0.1.0 diff --git a/Gemfile.lock b/Gemfile.lock index 41a40de..0ac6945 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ta_lib_ffi (0.1.0) + ta_lib_ffi (0.2.0) fiddle (~> 1.1) GEM diff --git a/README.md b/README.md index c735300..02d6563 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# TALib +# TALibFFI ![Tests](https://github.com/Youngv/ta_lib_ffi/actions/workflows/main.yml/badge.svg) ## Introduction -TALib is a Ruby binding for [TA-Lib](https://ta-lib.org/) (Technical Analysis Library) using FFI (Foreign Function Interface). It provides a comprehensive set of functions for technical analysis of financial market data. +TALibFFI is a Ruby binding for [TA-Lib](https://ta-lib.org/) (Technical Analysis Library) using FFI (Foreign Function Interface). It provides a comprehensive set of functions for technical analysis of financial market data. ## Requirements @@ -57,13 +57,13 @@ Or install it directly: ## Usage ```ruby -require 'ta_lib' +require 'ta_lib_ffi' # Initialize data prices = [10.0, 11.0, 12.0, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.0] # Calculate SMA -puts TALib.sma(prices, time_period: 3) +puts TALibFFI.sma(prices, time_period: 3) # => [11.0, 11.333333333333334, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0] ``` diff --git a/lib/ta_lib.rb b/lib/ta_lib_ffi.rb similarity index 98% rename from lib/ta_lib.rb rename to lib/ta_lib_ffi.rb index 54ebe7e..2d23a6a 100644 --- a/lib/ta_lib.rb +++ b/lib/ta_lib_ffi.rb @@ -4,8 +4,22 @@ require "fiddle/import" # Ruby FFI wrapper for TA-Lib (Technical Analysis Library) -module TALib - VERSION = "0.1.0" +module TALibFFI + VERSION = "0.2.0" + + if defined?(Zeitwerk) + # Custom inflector for handling special case module names like TALibFFI + class Inflector < Zeitwerk::GemInflector + def camelize(basename, _abspath) + case basename + when "ta_lib_ffi" + "TALibFFI" + else + super + end + end + end + end extend Fiddle::Importer diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bf0fb0c..236a2b8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "ta_lib" +require "ta_lib_ffi" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure diff --git a/spec/ta_lib_spec.rb b/spec/ta_lib_ffi_spec.rb similarity index 99% rename from spec/ta_lib_spec.rb rename to spec/ta_lib_ffi_spec.rb index 630cc69..6084978 100644 --- a/spec/ta_lib_spec.rb +++ b/spec/ta_lib_ffi_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe TALib do +RSpec.describe TALibFFI do shared_examples "ta_lib_input_validation" do |method_name| context "when input is invalid" do it "raises error for empty array" do @@ -24,7 +24,7 @@ describe "Version and Initialization" do it "has a version number" do - expect(described_class::VERSION).to eq("0.1.0") + expect(described_class::VERSION).to eq("0.2.0") end it "returns a string for TA-Lib version", skip: "Not implemented under Windows" do diff --git a/ta_lib_ffi.gemspec b/ta_lib_ffi.gemspec index cbbbf60..ac9d04f 100644 --- a/ta_lib_ffi.gemspec +++ b/ta_lib_ffi.gemspec @@ -1,10 +1,10 @@ # frozen_string_literal: true -require_relative "lib/ta_lib" +require_relative "lib/ta_lib_ffi" Gem::Specification.new do |spec| spec.name = "ta_lib_ffi" - spec.version = TALib::VERSION + spec.version = TALibFFI::VERSION spec.authors = ["Victor Yang"] spec.email = ["victor@rt4u.bid"] spec.summary = "Ruby FFI bindings for TA-Lib (Technical Analysis Library)"