Giter Club home page Giter Club logo

xls_function's Introduction

XlsFunction

badge

Excel-like Function Evaluator. You can get modified value by evaluated function string.

Installation

Add this line to your application's Gemfile:

gem 'xls_function'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install xls_function

Usage

  str = 'IF(LEFT("sample", 1) = "s", "this is sample", "what is this?")'
  result = XlsFunction.evaluate(str)
  p result # => "this is sample"

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/moneyforward/xls_function. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

  • You can create a pull request to the main branch.
  • You should not change the version on your pull request.

License

The gem is available as open source under the terms of the Apache License, Version 2.0.

Code of Conduct

Everyone interacting in the XlsFunction project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

xls_function's People

Contributors

yiyenene avatar watanabe-sh0 avatar kohei-miyazawa avatar koyo-miyamura avatar kuro0993 avatar

Stargazers

 avatar IZUKA Masahiro avatar Masumi Kawasaki avatar T.Yamashita avatar Riki Makita avatar Takayuki Maeda avatar

Watchers

Naoto Takai avatar Akira Matsuda avatar Takuya Kato / katton avatar Hirotaka Kawata avatar shase avatar Masaaki Aoyagi avatar Tomoyuki KAMIYA avatar Natsuko Nishikata avatar ryo.hongo avatar Hikaru tsuruta avatar  avatar Naoki Kuroda avatar kawakubox avatar r.tokugami avatar nito.shimpei avatar  avatar akinomaeni avatar knamae avatar SUZUKI Kentaro avatar wata avatar halo3121 avatar Yasuyuki Ageishi avatar Tatsunori Nishikori avatar shohei0203 avatar tkmknr avatar  avatar  avatar Takeshi Izumi avatar daigo424 avatar ACHA avatar  avatar M.Yamashita avatar Yasuhiro Muraji avatar Shiko Takahashi / 高橋志昂 avatar Satoshi Hashimoto avatar Nariyuki Saito avatar Toshihiro Yokota avatar Yoshitaka Terazawa avatar  avatar Mai Ishizawa avatar Nguyen Duc Tung (Steve) avatar Magdalena Mosakowska avatar Shervin Li avatar Takayuki TSUZUKI (Zuck) avatar masahiro_watari avatar kikuchi.kodai avatar Kenichi Shinagawa avatar jumpei.yokota avatar Lewis Reid avatar koichi uchinishi  avatar ogawa avatar An avatar himeno-yusuke avatar takaaki.iida avatar  avatar Shree Ram Neupane avatar Anupam Deb avatar satoshi harada avatar taisuke-ohmi avatar  avatar Hideaki Nire avatar hiro avatar Hideki Yagi avatar Yuto Eguma avatar Shinno avatar hummingbird avatar  avatar Ryosuke Kamei avatar ys1111 avatar akito hagio avatar Tuck avatar ota avatar nozaki keigo avatar sugoikondo avatar shuhei tsuji avatar toda hitomi avatar Yuto Mughal avatar Kento Watanabe avatar su.vay.tranh (Vincent) avatar Kaneko Yuto avatar  avatar Thai Ba Viet(タイ バー ヴィエット) avatar abe.takuma avatar Kato Yuna / cheese avatar yokoyama tatsuo avatar komisan19 avatar miyamoto.dai avatar hato avatar  avatar  avatar nekomaho avatar Fumiya Suzuki avatar  avatar Yuya Okino avatar Yuji Tamiya avatar Kuniko Sekine Rose avatar yusuke-eto avatar Kei Sugita avatar Kwak "kaku" Bumjin avatar Itaru Sugimoto avatar

xls_function's Issues

IFS returns array when no conditions match and else clause is missing in ruby 3.1

Backglond

IFS function behavior is unexpectedly changed in ruby 3.1

Example

ruby 2.7.5, ruby 3.0.5

irb> XlsFunction::VERSION
=> "0.1.1"
irb> XlsFunction.evaluate('IFS("0" = "0", "0")')
=> "0"
irb> XlsFunction.evaluate('IFS("0" = "100", "0")')
=> nil

ruby 3.1.2

irb> XlsFunction::VERSION
=> "0.1.1"
irb> XlsFunction.evaluate('IFS("0" = "0", "0")')
=> "0"
irb> XlsFunction.evaluate('IFS("0" = "100", "0")')
=> 
[#<XlsFunction::Evaluators::BinaryOperations::Equal:0x0000000108966a78
  @arg_list=
   [#<XlsFunction::Evaluators::StringEvaluator:0x00000001089671d0 @context={:variants=>{}, :caches=>{}, :string=>"0"@5}, @source="0"@5>,
    #<XlsFunction::Evaluators::StringEvaluator:0x0000000108966bb8 @context={:variants=>{}, :caches=>{}, :string=>"100"@11}, @source="100"@11>],
  @context=
   {:variants=>{},
    :caches=>{},
    :left=>#<XlsFunction::Evaluators::StringEvaluator:0x00000001089671d0 @context={:variants=>{}, :caches=>{}, :string=>"0"@5}, @source="0"@5>,
    :operator=>"="@8,
    :right=>#<XlsFunction::Evaluators::StringEvaluator:0x0000000108966bb8 @context={:variants=>{}, :caches=>{}, :string=>"100"@11}, @source="100"@11>,
    :arglist=>
     [#<XlsFunction::Evaluators::StringEvaluator:0x00000001089671d0 @context={:variants=>{}, :caches=>{}, :string=>"0"@5}, @source="0"@5>,
      #<XlsFunction::Evaluators::StringEvaluator:0x0000000108966bb8 @context={:variants=>{}, :caches=>{}, :string=>"100"@11}, @source="100"@11>]},
  @left="0",
  @right="100">,
 #<XlsFunction::Evaluators::StringEvaluator:0x0000000108966618 @context={:variants=>{}, :caches=>{}, :string=>"0"@18}, @source="0"@18>]

add rbs type

Backglond

There are several benefits to using RBS for introducing types into Ruby projects. Firstly, it helps to improve code readability and maintainability, as type signatures make it easier to understand the input and output types of functions and methods. Additionally, RBS can help catch type errors during the development process, reducing the likelihood of runtime errors and improving overall code quality.

Furthermore, RBS allows for better tooling support, as editors and IDEs can use type information to provide autocompletion, type hints, and other helpful features. This can improve developer productivity and reduce the time required for debugging and testing.

Finally, using RBS can help facilitate interoperability between different Ruby projects and libraries, as well as with other programming languages that support typed interfaces. This can make it easier to build and maintain complex software systems with Ruby at their core.

by Chat GPT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.