Sha256: 9eb208ed0543e6f66e3acca001f0f073c29f3929302c94d763ae83e36b2b0cf0
Contents?: true
Size: 820 Bytes
Versions: 4
Compression:
Stored size: 820 Bytes
Contents
#include <ruby.h> #include "robots.h" #include <string> typedef VALUE(ruby_method)(...); extern "C" { static VALUE m_Robotstxt; static VALUE robotstxt_allowed_by_robots(VALUE self, VALUE robots_content, VALUE user_agent, VALUE url) { Check_Type(robots_content, T_STRING); Check_Type(user_agent, T_STRING); Check_Type(url, T_STRING); std::string rc = RSTRING_PTR(robots_content); std::string ua = RSTRING_PTR(user_agent); std::string ur = RSTRING_PTR(url); googlebot::RobotsMatcher matcher; bool result = matcher.OneAgentAllowedByRobots(rc, ua, ur); return result ? Qtrue : Qfalse; } void Init_robotstxt() { m_Robotstxt = rb_define_module("Robotstxt"); rb_define_method(m_Robotstxt, "allowed_by_robots", (ruby_method *)&robotstxt_allowed_by_robots, 3); } }
Version data entries
4 entries across 4 versions & 1 rubygems