#include #include "from_ruby_defn.hpp" namespace Rice { template inline MethodInfo::MethodInfo(size_t argCount, const Arg_Ts&...args) { // Process the passed in arguments (this->processArg(args), ...); // Fill in any missing arguments for (size_t i = this->args_.size(); i < argCount; i++) { Arg arg("arg_" + std::to_string(i)); this->args_.emplace_back(arg); } // TODO - so hacky but update the Arg positions for (uint32_t i = 0; i < this->args_.size(); i++) { this->args_[i].position = i; } } template inline void MethodInfo::processArg(const Arg_T& arg) { if constexpr (std::is_same_v) { this->addArg(arg); } else { this->returnInfo = arg; } } inline void MethodInfo::addArg(const Arg& arg) { this->args_.push_back(arg); } inline std::string MethodInfo::formatString() { size_t required = 0; size_t optional = 0; for (const Arg& arg : this->args_) { if (arg.hasDefaultValue()) { optional++; } else { required++; } } return std::to_string(required) + std::to_string(optional); } inline Arg& MethodInfo::arg(size_t pos) { return args_[pos]; } inline std::vector::iterator MethodInfo::begin() { return this->args_.begin(); } inline std::vector::iterator MethodInfo::end() { return this->args_.end(); } }