repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/message_content/tool_result.rb
lib/intelligence/message_content/tool_result.rb
module Intelligence module MessageContent class ToolResult < Base schema do tool_call_id tool_name String, required: true tool_result [ Hash, String ] end attribute :tool_call_id, :tool_name, :tool_result def valid? tool_call_id &...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/message_content/base.rb
lib/intelligence/message_content/base.rb
module Intelligence module MessageContent class Base include DynamicSchema::Definable class << self def attribute( *names ) names.each do | name | define_method( name ) { @attributes[ name ] } end end def type @type ||= begin ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/message_content/web_search_call.rb
lib/intelligence/message_content/web_search_call.rb
module Intelligence module MessageContent class WebSearchCall < Base schema do status Symbol, in: [ :searching, :complete ] query String end attribute :status, :query def valid? true end def complete? ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/message_content/tool_call.rb
lib/intelligence/message_content/tool_call.rb
module Intelligence module MessageContent class ToolCall < Base schema do tool_call_id String tool_name String, required: true tool_parameters [ Hash, String ] end attribute :tool_call_id, :tool_name def tool_parameters( options = ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/message_content/cipher_thought.rb
lib/intelligence/message_content/cipher_thought.rb
module Intelligence module MessageContent class CipherThought < Base # note: a cipher thought has no portable payload; only vendor specific # payloads; such as that from openai def valid? true end end end end
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/generic.rb
lib/intelligence/adapters/generic.rb
require_relative '../adapter' require_relative 'generic/adapter'
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/hyperbolic.rb
lib/intelligence/adapters/hyperbolic.rb
require_relative 'generic/adapter' module Intelligence module Hyperbolic class Adapter < Generic::Adapter DEFAULT_BASE_URI = 'https://api.hyperbolic.xyz/v1' schema do base_uri String, default: DEFAULT_BASE_URI key String chat_optio...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/x_ai.rb
lib/intelligence/adapters/x_ai.rb
require_relative 'generic/adapter' require_relative 'x_ai/adapter'
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/cerebras.rb
lib/intelligence/adapters/cerebras.rb
require_relative 'generic/adapter' module Intelligence module Cerebras class Adapter < Generic::Adapter DEFAULT_BASE_URI = 'https://api.cerebras.ai/v1' schema do base_uri String, default: DEFAULT_BASE_URI key String chat_options d...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/ollama.rb
lib/intelligence/adapters/ollama.rb
require_relative 'generic/adapter' module Intelligence module Ollama class Adapter < Generic::Adapter DEFAULT_BASE_URI = 'http://localhost:11435/v1' schema do base_uri String, default: DEFAULT_BASE_URI key String chat_...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/mistral.rb
lib/intelligence/adapters/mistral.rb
require_relative 'generic/adapter' module Intelligence module Mistral class Adapter < Generic::Adapter DEFAULT_BASE_URI = "https://api.mistral.ai/v1" schema do base_uri String, default: DEFAULT_BASE_URI key String ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/samba_nova.rb
lib/intelligence/adapters/samba_nova.rb
require_relative 'generic/adapter' module Intelligence module SambaNova class Adapter < Generic::Adapter DEFAULT_BASE_URI = "https://api.sambanova.ai/v1" schema do # normalized properties for all endpoints base_uri String, default: DEFAULT_BASE_URI ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/google.rb
lib/intelligence/adapters/google.rb
require_relative '../adapter' require_relative 'google/adapter'
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/anthropic.rb
lib/intelligence/adapters/anthropic.rb
require_relative '../adapter' require_relative 'anthropic/adapter' require_relative 'anthropic/extensions'
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/azure.rb
lib/intelligence/adapters/azure.rb
require_relative 'generic' module Intelligence module Azure class Adapter < Generic::Adapter CHAT_COMPLETIONS_PATH = 'chat/completions' schema do # normalized properties, used by all endpoints base_uri String, required: true key ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/together_ai.rb
lib/intelligence/adapters/together_ai.rb
require_relative 'generic/adapter' module Intelligence module TogetherAi class Adapter < Generic::Adapter DEFAULT_BASE_URI = "https://api.together.xyz/v1" schema do base_uri String, default: DEFAULT_BASE_URI key String cha...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/parallax.rb
lib/intelligence/adapters/parallax.rb
require_relative 'generic/adapter' module Intelligence module Parallax class Adapter < Generic::Adapter DEFAULT_BASE_URI = 'http://localhost:3000/v1' schema do base_uri String, default: DEFAULT_BASE_URI key String chat...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/open_router.rb
lib/intelligence/adapters/open_router.rb
require_relative 'generic/adapter' module Intelligence module OpenRouter class Adapter < Generic::Adapter DEFAULT_BASE_URI = 'https://openrouter.ai/api/v1' schema do base_uri String, default: DEFAULT_BASE_URI key String c...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/groq.rb
lib/intelligence/adapters/groq.rb
require_relative 'generic/adapter' module Intelligence module Groq class Adapter < Generic::Adapter DEFAULT_BASE_URI = 'https://api.groq.com/openai/v1' schema do base_uri String, default: DEFAULT_BASE_URI key String cha...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/open_ai_legacy.rb
lib/intelligence/adapters/open_ai_legacy.rb
require_relative 'generic/adapter' module Intelligence module OpenAiLegacy class Adapter < Generic::Adapter DEFAULT_BASE_URI = 'https://api.openai.com/v1' schema do # normalized properties, used by all endpoints base_uri String, default: DEFAULT_BAS...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/open_ai.rb
lib/intelligence/adapters/open_ai.rb
require_relative '../adapter' require_relative 'open_ai/adapter'
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/generic/chat_request_methods.rb
lib/intelligence/adapters/generic/chat_request_methods.rb
module Intelligence module Generic module ChatRequestMethods module ClassMethods def chat_request_uri( uri = nil ) if uri @chat_request_uri = uri else @chat_request_uri end end end CHAT_COMPLETIONS_PATH = 'chat/completions' ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/generic/adapter.rb
lib/intelligence/adapters/generic/adapter.rb
require_relative '../../adapter' require_relative 'chat_request_methods' require_relative 'chat_response_methods' module Intelligence module Generic class Adapter < Adapter::Base include ChatRequestMethods include ChatResponseMethods end end end
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/generic/chat_response_methods.rb
lib/intelligence/adapters/generic/chat_response_methods.rb
module Intelligence module Generic module ChatResponseMethods def chat_result_attributes( response ) return nil unless response.success? response_json = JSON.parse( response.body, symbolize_names: true ) rescue nil return nil if response_json.nil? || response_json[ :choices ].nil? ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/open_ai/chat_request_methods.rb
lib/intelligence/adapters/open_ai/chat_request_methods.rb
module Intelligence module OpenAi module ChatRequestMethods CHAT_COMPLETIONS_PATH = 'responses' SUPPORTED_CONTENT_TYPES = [ 'image/jpeg', 'image/png', 'image/webp' ] def chat_request_uri( options = nil ) options = merge_options( @options, build_options( options ) ) base_uri = o...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/open_ai/adapter.rb
lib/intelligence/adapters/open_ai/adapter.rb
require_relative 'chat_request_methods' require_relative 'chat_response_methods' module Intelligence module OpenAi class Adapter < Adapter::Base DEFAULT_BASE_URI = 'https://api.openai.com/v1' schema do # normalized properties, used by all endpoints base_uri ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/open_ai/chat_response_methods.rb
lib/intelligence/adapters/open_ai/chat_response_methods.rb
module Intelligence module OpenAi module ChatResponseMethods def chat_result_attributes( response ) return nil unless response.success? response_json = JSON.parse( response.body, symbolize_names: true ) rescue nil return nil if response_json.nil? result = { id: response_jso...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/x_ai/chat_request_methods.rb
lib/intelligence/adapters/x_ai/chat_request_methods.rb
module Intelligence module XAi module ChatRequestMethods def chat_request_body( conversation, options = nil ) tools = options.delete( :tools ) || [] web_search_parameters = options.delete( :search_parameters ) || {} options = merge_options( @options, build_options( options ) ) ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/x_ai/adapter.rb
lib/intelligence/adapters/x_ai/adapter.rb
require_relative 'chat_request_methods' require_relative 'chat_response_methods' module Intelligence module XAi class Adapter < Generic::Adapter DEFAULT_BASE_URI = "https://api.x.ai/v1" schema do base_uri String, default: DEFAULT_BASE_URI key ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/x_ai/chat_response_methods.rb
lib/intelligence/adapters/x_ai/chat_response_methods.rb
module Intelligence module XAi module ChatResponseMethods def chat_result_attributes( response ) return nil unless response.success? response_json = JSON.parse( response.body, symbolize_names: true ) rescue nil return nil if response_json.nil? || response_json[ :choices ].nil? ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/anthropic/extensions.rb
lib/intelligence/adapters/anthropic/extensions.rb
require_relative 'extensions/cache_control'
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/anthropic/chat_request_methods.rb
lib/intelligence/adapters/anthropic/chat_request_methods.rb
module Intelligence module Anthropic module ChatRequestMethods CHAT_REQUEST_URI = "https://api.anthropic.com/v1/messages" SUPPORTED_CONTENT_TYPES = %w[ image/jpeg image/png image/gif image/webp application/pdf ] def chat_request_uri( options ) CHAT_REQUEST_URI end def cha...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/anthropic/adapter.rb
lib/intelligence/adapters/anthropic/adapter.rb
require_relative 'chat_request_methods' require_relative 'chat_response_methods' module Intelligence module Anthropic class Adapter < Adapter::Base schema do # normalized properties for all endpoints key # anthropic specific properties for all endpoints version ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/anthropic/chat_response_methods.rb
lib/intelligence/adapters/anthropic/chat_response_methods.rb
module Intelligence module Anthropic module ChatResponseMethods def chat_result_attributes( response ) return nil unless response.success? response_json = JSON.parse( response.body, symbolize_names: true ) rescue nil return nil if response_json.nil? result = {} ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/anthropic/extensions/cache_control.rb
lib/intelligence/adapters/anthropic/extensions/cache_control.rb
module Intelligence module Anthropic module Extensions module MessageContent module CacheControl def cache_control @_cache_control end def cache_control=( value ) @_cache_control = case value when true, :...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/google/chat_request_methods.rb
lib/intelligence/adapters/google/chat_request_methods.rb
require 'uri' module Intelligence module Google module ChatRequestMethods GENERATIVE_LANGUAGE_URI = "https://generativelanguage.googleapis.com/v1beta/models/" SUPPORTED_BINARY_MEDIA_TYPES = %w[ text ] SUPPORTED_BINARY_CONTENT_TYPES = %w[ image/png image/jpeg image/webp image/heic ima...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/google/adapter.rb
lib/intelligence/adapters/google/adapter.rb
require_relative 'chat_request_methods' require_relative 'chat_response_methods' module Intelligence module Google class Adapter < Adapter::Base schema do # normalized properties for all endpoints key String chat_options as: :generationConfig do ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapters/google/chat_response_methods.rb
lib/intelligence/adapters/google/chat_response_methods.rb
require 'uri' module Intelligence module Google module ChatResponseMethods def chat_result_attributes( response ) return nil unless response.success? response_json = JSON.parse( response.body, symbolize_names: true ) rescue nil return nil if response_json.nil? || response_json[ :c...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/utilities/deep_dup.rb
lib/intelligence/utilities/deep_dup.rb
module Intelligence module Utilities def deep_dup( object ) case object when Hash object.each_with_object( { } ) do | ( key, value ), target | target[ key ] = deep_dup( value ) end when Array object.map { | element | deep_dup( element ) } els...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapter/module_methods.rb
lib/intelligence/adapter/module_methods.rb
module Intelligence module Adapter module ModuleMethods def []( adapter_type ) raise ArgumentError.new( "An adapter type is required but nil was given." ) \ if adapter_type.nil? class_name = adapter_type.to_s.split( '_' ).map( &:capitalize ).join class_name += "::Adapter...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapter/class_methods.rb
lib/intelligence/adapter/class_methods.rb
module Intelligence module Adapter module ClassMethods def build( options = nil, &block ) new( configuration: builder.build( options, &block ) ) end def build!( options = nil, &block ) new( configuration: builder.build( options, &block ) ) end end end end
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapter/instance_methods.rb
lib/intelligence/adapter/instance_methods.rb
module Intelligence module Adapter module InstanceMethods def build_options( options ) return {} unless options&.any? self.class.builder.build( options ) end def merge_options( options, other_options ) merged_options = Utilities.deep_dup( options ) ...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
EndlessInternational/intelligence
https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/lib/intelligence/adapter/base.rb
lib/intelligence/adapter/base.rb
require_relative 'class_methods' require_relative 'instance_methods' module Intelligence module Adapter class Base include DynamicSchema::Definable extend ClassMethods def initialize( options = {}, configuration: nil ) @options = build_options( options ) @options = configuratio...
ruby
MIT
2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a
2026-01-04T17:53:00.421273Z
false
eparreno/ruby_regex
https://github.com/eparreno/ruby_regex/blob/443facc47284b0e81726df46ba8543b67a94623c/test/ruby_regex_test.rb
test/ruby_regex_test.rb
require 'test/unit' require 'yaml' require File.join( File.dirname(__FILE__), '../lib/ruby_regex' ) class RubyRegexTest < Test::Unit::TestCase #Username def test_valid_usernames check_valid_regex RubyRegex::Username, ['test', 'test_test', 'test1', 'test_1'] end def test_invalid_usernames check_invali...
ruby
MIT
443facc47284b0e81726df46ba8543b67a94623c
2026-01-04T17:55:37.482157Z
false
eparreno/ruby_regex
https://github.com/eparreno/ruby_regex/blob/443facc47284b0e81726df46ba8543b67a94623c/lib/ruby_regex.rb
lib/ruby_regex.rb
module RubyRegex # Username # This regular expression doesn't validate username's length Username = /\A[a-zA-Z0-9_]*\z/ # Dni (spanish ID card) Dni = /\A\d{8}[A-Za-z]{1}\z/ # URL Url = URL = /(\A\z)|(\A(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?\z)/ix # Domain Do...
ruby
MIT
443facc47284b0e81726df46ba8543b67a94623c
2026-01-04T17:55:37.482157Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/test_helper.rb
test/test_helper.rb
# frozen_string_literal: true require 'rubygems' require 'minitest/autorun' require 'active_record' require 'mongoid' # Configure Rails Environment environment = ENV['RAILS_ENV'] = 'test' rails_root = File.expand_path('dummy', __dir__) database_yml = File.expand_path('config/database.yml', rails_root) ActiveRecor...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/support/reloadable.rb
test/support/reloadable.rb
# frozen_string_literal: true module MiniTest class Unit class TestCase def teardown Object.send(:remove_const, 'Canard') if Object.const_defined?('Canard') GC.start end def setup ['canard/abilities.rb', 'canard/user_model.rb', 'canard/find_abilities.r...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/abilities/administrators.rb
test/abilities/administrators.rb
# frozen_string_literal: true Canard::Abilities.for(:administrator) do can :manage, [Activity, User] end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/abilities/users.rb
test/dummy/app/abilities/users.rb
# frozen_string_literal: true Canard::Abilities.for(:user) do can %i[edit update], Member, user_id: user.id end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/abilities/editors.rb
test/dummy/app/abilities/editors.rb
# frozen_string_literal: true Canard::Abilities.for(:editor) do includes_abilities_of :author cannot :create, Post end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/abilities/admins.rb
test/dummy/app/abilities/admins.rb
# frozen_string_literal: true Canard::Abilities.for(:admin) do can :manage, [Post, User] cannot :destroy, User do |u| (user == u) end end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/abilities/authors.rb
test/dummy/app/abilities/authors.rb
# frozen_string_literal: true Canard::Abilities.for(:author) do can %i[create update read], Post end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/abilities/guests.rb
test/dummy/app/abilities/guests.rb
# frozen_string_literal: true Canard::Abilities.for(:guest) do can :read, Post end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/controllers/application_controller.rb
test/dummy/app/controllers/application_controller.rb
# frozen_string_literal: true class ApplicationController < ActionController::Base protect_from_forgery end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/models/plain_ruby_user.rb
test/dummy/app/models/plain_ruby_user.rb
# frozen_string_literal: true class PlainRubyUser extend Canard::UserModel attr_accessor :roles_mask def initialize(*roles) self.roles = roles end end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/models/member.rb
test/dummy/app/models/member.rb
# frozen_string_literal: true class Member < ActiveRecord::Base belongs_to :user attr_accessible :user, :user_id end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/models/plain_ruby_non_user.rb
test/dummy/app/models/plain_ruby_non_user.rb
# frozen_string_literal: true class PlainRubyNonUser extend Canard::UserModel end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/models/post.rb
test/dummy/app/models/post.rb
# frozen_string_literal: true class Post < ActiveRecord::Base end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/models/activity.rb
test/dummy/app/models/activity.rb
# frozen_string_literal: true class Activity end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/models/mongoid_user.rb
test/dummy/app/models/mongoid_user.rb
# frozen_string_literal: true class MongoidUser include Mongoid::Document acts_as_user roles: %i[viewer author admin] end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/models/user_without_role.rb
test/dummy/app/models/user_without_role.rb
# frozen_string_literal: true class UserWithoutRole < ActiveRecord::Base acts_as_user attr_accessible :roles end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/models/user_without_role_mask.rb
test/dummy/app/models/user_without_role_mask.rb
# frozen_string_literal: true class UserWithoutRoleMask < ActiveRecord::Base attr_accessible :roles end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/app/models/user.rb
test/dummy/app/models/user.rb
# frozen_string_literal: true class User < ActiveRecord::Base acts_as_user roles: %i[viewer author admin editor] attr_accessible :roles end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/db/schema.rb
test/dummy/db/schema.rb
# frozen_string_literal: true # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the auth...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/db/migrate/20120430083231_initialize_db.rb
test/dummy/db/migrate/20120430083231_initialize_db.rb
# frozen_string_literal: true class InitializeDb < ActiveRecord::Migration def change create_table :users, force: true do |t| t.integer :roles_mask end create_table :user_without_roles, force: true do |t| t.integer :roles_mask end create_table :user_without_role_masks, force: ...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/config/application.rb
test/dummy/config/application.rb
# frozen_string_literal: true require File.expand_path('boot', __dir__) # Pick the frameworks you want: require 'active_record/railtie' require 'action_controller/railtie' require 'active_resource/railtie' require 'rails/test_unit/railtie' Bundler.require if defined?(Bundler) require 'canard' module Dummy class A...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/config/environment.rb
test/dummy/config/environment.rb
# frozen_string_literal: true # Load the rails application require File.expand_path('application', __dir__) # Initialize the rails application Dummy::Application.initialize!
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/config/routes.rb
test/dummy/config/routes.rb
# frozen_string_literal: true Dummy::Application.routes.draw do end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/config/boot.rb
test/dummy/config/boot.rb
# frozen_string_literal: true require 'rubygems' gemfile = File.expand_path('../../../Gemfile', __dir__) if File.exist?(gemfile) ENV['BUNDLE_GEMFILE'] = gemfile require 'bundler' Bundler.setup end $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/config/initializers/session_store.rb
test/dummy/config/initializers/session_store.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the ...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/config/initializers/wrap_parameters.rb
test/dummy/config/initializers/wrap_parameters.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_co...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/config/initializers/secret_token.rb
test/dummy/config/initializers/secret_token.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/config/environments/test.rb
test/dummy/config/environments/test.rb
# frozen_string_literal: true Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "s...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/dummy/config/environments/development.rb
test/dummy/config/environments/development.rb
# frozen_string_literal: true Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/canard/find_abilities_test.rb
test/canard/find_abilities_test.rb
# frozen_string_literal: true require 'test_helper' describe Canard do describe 'find_abilities' do before do Canard::Abilities.definition_paths = [File.expand_path('../dummy/app/abilities', __dir__)] end it 'loads the abilities into ability_definitions' do Canard.find_abilities Cana...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/canard/abilities_test.rb
test/canard/abilities_test.rb
# frozen_string_literal: true require 'test_helper' require 'canard' describe 'Canard::Abilities' do subject { Canard::Abilities } describe 'ability_paths' do it 'defaults to app/abilities' do subject.definition_paths.must_include 'app/abilities' end it 'appends paths' do subject.definit...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/canard/ability_test.rb
test/canard/ability_test.rb
# frozen_string_literal: true require 'test_helper' describe Ability do before do Canard::Abilities.definition_paths = [File.expand_path('../dummy/app/abilities', __dir__)] # reload abilities because the reloader will have removed them after the railtie ran Canard.find_abilities end describe 'new' ...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/canard/canard_test.rb
test/canard/canard_test.rb
# frozen_string_literal: true require 'test_helper' require 'canard' describe Canard do describe 'ability_definitions' do it 'should be an accessor' do Canard.must_respond_to(:ability_definitions) end it 'should be a hash' do Canard.ability_definitions.must_be_instance_of Hash end end...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/canard/user_model_test.rb
test/canard/user_model_test.rb
# frozen_string_literal: true require 'test_helper' describe Canard::UserModel do describe 'acts_as_user' do describe 'integrating RoleModel' do before do PlainRubyUser.acts_as_user end it 'adds role_model to the class' do PlainRubyUser.included_modules.must_include RoleModel ...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/canard/adapters/active_record_test.rb
test/canard/adapters/active_record_test.rb
# frozen_string_literal: true require 'test_helper' describe Canard::Adapters::ActiveRecord do describe 'acts_as_user' do describe 'with a role_mask' do describe 'and :roles => [] specified' do it 'sets the valid_roles for the class' do User.valid_roles.must_equal %i[viewer author admin ...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/test/canard/adapters/mongoid_test.rb
test/canard/adapters/mongoid_test.rb
# frozen_string_literal: true require 'test_helper' require 'bson' describe Canard::Adapters::Mongoid do describe 'acts_as_user' do describe 'with a role_mask' do describe 'and :roles => [] specified' do it 'sets the valid_roles for the class' do MongoidUser.valid_roles.must_equal %i[vie...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/canard.rb
lib/canard.rb
# frozen_string_literal: true require 'forwardable' require 'cancan' require 'role_model' require 'canard/abilities' require 'canard/version' require 'canard/user_model' require 'canard/find_abilities' require 'ability' require 'canard/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/ability.rb
lib/ability.rb
# frozen_string_literal: true # Canard provides a CanCan Ability class for you. The Canard Ability class # looks for and applies abilities for the object passed when a new Ability # instance is initialized. # # If the passed object has a reference to user the user is set to that. # Otherwise the passed object is assum...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/generators/ability_definition.rb
lib/generators/ability_definition.rb
# frozen_string_literal: true require 'active_support/inflector' class AbilityDefinition # :nodoc: attr_accessor :cans, :cannots def self.parse(definitions) @@ability_definitions ||= {} limitation, ability_list, model_list = definitions.split(':') ability_names = extract(ability_list) model_names...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/generators/rspec/ability/ability_generator.rb
lib/generators/rspec/ability/ability_generator.rb
# frozen_string_literal: true require 'generators/rspec' require_relative '../../ability_definition' module Rspec module Generators class AbilityGenerator < Base @_rspec_source_root = File.expand_path('templates', __dir__) argument :ability_definitions, type: :array, default: [], banner: 'can:abilit...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/generators/canard/ability/ability_generator.rb
lib/generators/canard/ability/ability_generator.rb
# frozen_string_literal: true require_relative '../../ability_definition' module Canard module Generators class AbilityGenerator < Rails::Generators::NamedBase # :nodoc: source_root File.expand_path('templates', __dir__) argument :ability_definitions, type: :array, defa...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/canard/abilities.rb
lib/canard/abilities.rb
# frozen_string_literal: true module Canard class Abilities # :nodoc: @definitions = {} @default_path = 'app/abilities' class << self extend Forwardable def_delegators :Canard, :ability_key attr_accessor :default_path attr_writer :definition_paths attr_reader :definiti...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/canard/version.rb
lib/canard/version.rb
# frozen_string_literal: true module Canard VERSION = '0.6.2.pre' end
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/canard/railtie.rb
lib/canard/railtie.rb
# frozen_string_literal: true module Canard class Railtie < Rails::Railtie # :nodoc: initializer 'canard.no_eager_loading', before: 'before_eager_loading' do |app| ActiveSupport::Dependencies.autoload_paths.reject! { |path| Canard.load_paths.include?(path) } # Don't eagerload our configs, we'll deal ...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/canard/user_model.rb
lib/canard/user_model.rb
# frozen_string_literal: true module Canard # Canard applies roles to a model using the acts_as_user class method. The following User model # will be given the :manager and :admin roles # # class User < ActiveRecord::Base # # acts_as_user :roles => [:manager, :admin] # # end # # If using Ca...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/canard/find_abilities.rb
lib/canard/find_abilities.rb
# frozen_string_literal: true module Canard # :nodoc: def self.ability_definitions Abilities.definitions end def self.ability_key(class_name) String(class_name) .gsub('::', '') .gsub(/(.)([A-Z])/, '\1_\2') .downcase .to_sym end def self.load_paths Abilities.definition_pa...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/canard/adapters/active_record.rb
lib/canard/adapters/active_record.rb
# frozen_string_literal: true module Canard module Adapters module ActiveRecord # :nodoc: private def add_role_scopes(**options) define_scopes(options) if active_record_table_exists? end def define_scopes(options) valid_roles.each do |role| define_scopes_for_ro...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
james2m/canard
https://github.com/james2m/canard/blob/6040110ed79bbb8051d0c487c77ba2160e404516/lib/canard/adapters/mongoid.rb
lib/canard/adapters/mongoid.rb
# frozen_string_literal: true module Canard module Adapters module Mongoid # :nodoc: private def add_role_scopes(*args) options = args.extract_options! valid_roles.each do |role| define_scopes_for_role role, options[:prefix] end define_singleton_method(:wit...
ruby
MIT
6040110ed79bbb8051d0c487c77ba2160e404516
2026-01-04T17:55:41.739331Z
false
dtaniwaki/mandriller
https://github.com/dtaniwaki/mandriller/blob/c9f6c0d840dd78547491504fe4450bf2b1317dce/spec/spec_helper.rb
spec/spec_helper.rb
require 'rubygems' require 'coveralls' Coveralls.wear! require 'mandriller' Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f } RSpec.configure do |config| config.before :suite do ActionMailer::Base.delivery_method = :test end end
ruby
MIT
c9f6c0d840dd78547491504fe4450bf2b1317dce
2026-01-04T17:55:41.600973Z
false
dtaniwaki/mandriller
https://github.com/dtaniwaki/mandriller/blob/c9f6c0d840dd78547491504fe4450bf2b1317dce/spec/mandriller/settings_methods_spec.rb
spec/mandriller/settings_methods_spec.rb
require 'spec_helper' describe Mandriller::SettingsMethods do let(:klass) do Class.new do include Mandriller::SettingsMethods end end subject do klass.class_eval do define_settings_methods :foo end klass end describe "::define_settings_methods" do it "defines the methods"...
ruby
MIT
c9f6c0d840dd78547491504fe4450bf2b1317dce
2026-01-04T17:55:41.600973Z
false
dtaniwaki/mandriller
https://github.com/dtaniwaki/mandriller/blob/c9f6c0d840dd78547491504fe4450bf2b1317dce/spec/mandriller/base_spec.rb
spec/mandriller/base_spec.rb
require 'spec_helper' describe Mandriller::Base do let(:global_settings) { lambda{} } let(:local_settings) { lambda{} } let(:klass) do gs = global_settings ls = local_settings klass = Class.new(Mandriller::Base) do self.mailer_name = 'foo_mailer' instance_exec(&gs) define_method :fo...
ruby
MIT
c9f6c0d840dd78547491504fe4450bf2b1317dce
2026-01-04T17:55:41.600973Z
false
dtaniwaki/mandriller
https://github.com/dtaniwaki/mandriller/blob/c9f6c0d840dd78547491504fe4450bf2b1317dce/spec/support/action_mailer.rb
spec/support/action_mailer.rb
deliver_method = ActionMailer.respond_to?(:version) && ActionMailer.version.to_s.to_f >= 4.2 ? :deliver_now! : :deliver! shared_examples "with header" do |header, value| it "sets header #{header}" do expect { subject.__send__(deliver_method) }.to change { ActionMailer::Base.deliveries.count }.by(1) ...
ruby
MIT
c9f6c0d840dd78547491504fe4450bf2b1317dce
2026-01-04T17:55:41.600973Z
false
dtaniwaki/mandriller
https://github.com/dtaniwaki/mandriller/blob/c9f6c0d840dd78547491504fe4450bf2b1317dce/lib/mandriller.rb
lib/mandriller.rb
require 'mandriller/version' require 'mandriller/errors' require 'mandriller/base' module Mandriller end
ruby
MIT
c9f6c0d840dd78547491504fe4450bf2b1317dce
2026-01-04T17:55:41.600973Z
false
dtaniwaki/mandriller
https://github.com/dtaniwaki/mandriller/blob/c9f6c0d840dd78547491504fe4450bf2b1317dce/lib/mandriller/version.rb
lib/mandriller/version.rb
module Mandriller VERSION = '0.2.0' end
ruby
MIT
c9f6c0d840dd78547491504fe4450bf2b1317dce
2026-01-04T17:55:41.600973Z
false
dtaniwaki/mandriller
https://github.com/dtaniwaki/mandriller/blob/c9f6c0d840dd78547491504fe4450bf2b1317dce/lib/mandriller/errors.rb
lib/mandriller/errors.rb
module Mandriller class Exception < ::Exception; end; class InvalidHeaderValue < Exception; end; end
ruby
MIT
c9f6c0d840dd78547491504fe4450bf2b1317dce
2026-01-04T17:55:41.600973Z
false