source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Quantity.rb | Ruby | apache-2.0 | 92 | master | 1,343 | module FHIR
module R4
class Quantity < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Quantity.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Quantity.exte... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/ElementDefinition.rb | Ruby | apache-2.0 | 92 | master | 67,935 | module FHIR
module R4
class ElementDefinition < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
include FHIR::CommonElementDefinition
MULTIPLE_TYPES = {
'defaultValue' => ['base64Binary', 'boolean', 'canonical', 'code', 'date', 'dateTime', 'decimal', 'id', ... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Ratio.rb | Ruby | apache-2.0 | 92 | master | 788 | module FHIR
module R4
class Ratio < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Ratio.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Ratio.extension', '... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Period.rb | Ruby | apache-2.0 | 92 | master | 763 | module FHIR
module R4
class Period < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Period.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Period.extension'... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/TriggerDefinition.rb | Ruby | apache-2.0 | 92 | master | 2,269 | module FHIR
module R4
class TriggerDefinition < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
MULTIPLE_TYPES = {
'timing' => ['Timing', 'Reference', 'date', 'dateTime']
}
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/MarketingStatus.rb | Ruby | apache-2.0 | 92 | master | 1,576 | module FHIR
module R4
class MarketingStatus < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'MarketingStatus.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/HumanName.rb | Ruby | apache-2.0 | 92 | master | 1,689 | module FHIR
module R4
class HumanName < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'HumanName.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'HumanName.e... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/DataRequirement.rb | Ruby | apache-2.0 | 92 | master | 9,652 | module FHIR
module R4
class DataRequirement < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
MULTIPLE_TYPES = {
'subject' => ['CodeableConcept', 'Reference']
}
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'DataRequ... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Range.rb | Ruby | apache-2.0 | 92 | master | 754 | module FHIR
module R4
class Range < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Range.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Range.extension', '... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Expression.rb | Ruby | apache-2.0 | 92 | master | 1,427 | module FHIR
module R4
class Expression < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Expression.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Expressio... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/ParameterDefinition.rb | Ruby | apache-2.0 | 92 | master | 5,601 | module FHIR
module R4
class ParameterDefinition < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'ParameterDefinition.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', ... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Contributor.rb | Ruby | apache-2.0 | 92 | master | 1,150 | module FHIR
module R4
class Contributor < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Contributor.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Contrib... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/SubstanceAmount.rb | Ruby | apache-2.0 | 92 | master | 2,615 | module FHIR
module R4
class SubstanceAmount < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
MULTIPLE_TYPES = {
'amount' => ['Quantity', 'Range', 'string']
}
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'SubstanceA... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/ContactPoint.rb | Ruby | apache-2.0 | 92 | master | 1,612 | module FHIR
module R4
class ContactPoint < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'ContactPoint.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Conta... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/ProdCharacteristic.rb | Ruby | apache-2.0 | 92 | master | 2,547 | module FHIR
module R4
class ProdCharacteristic < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'ProdCharacteristic.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'p... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Coding.rb | Ruby | apache-2.0 | 92 | master | 1,175 | module FHIR
module R4
class Coding < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Coding.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Coding.extension'... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/UsageContext.rb | Ruby | apache-2.0 | 92 | master | 2,303 | module FHIR
module R4
class UsageContext < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
MULTIPLE_TYPES = {
'value' => ['CodeableConcept', 'Quantity', 'Range', 'Reference']
}
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', '... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Attachment.rb | Ruby | apache-2.0 | 92 | master | 2,268 | module FHIR
module R4
class Attachment < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Attachment.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Attachmen... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Extension.rb | Ruby | apache-2.0 | 92 | master | 9,376 | module FHIR
module R4
class Extension < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
MULTIPLE_TYPES = {
'value' => ['base64Binary', 'boolean', 'canonical', 'code', 'date', 'dateTime', 'decimal', 'id', 'instant', 'integer', 'markdown', 'oid', 'positiveInt', 'st... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Reference.rb | Ruby | apache-2.0 | 92 | master | 1,068 | module FHIR
module R4
class Reference < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Reference.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Reference.e... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/RelatedArtifact.rb | Ruby | apache-2.0 | 92 | master | 1,807 | module FHIR
module R4
class RelatedArtifact < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'RelatedArtifact.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Meta.rb | Ruby | apache-2.0 | 92 | master | 3,913 | module FHIR
module R4
class Meta < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Meta.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Meta.extension', 'min... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Dosage.rb | Ruby | apache-2.0 | 92 | master | 29,971 | module FHIR
module R4
class Dosage < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
MULTIPLE_TYPES = {
'asNeeded' => ['boolean', 'CodeableConcept']
}
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Dosage.id', 'min'=... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/ProductShelfLife.rb | Ruby | apache-2.0 | 92 | master | 1,543 | module FHIR
module R4
class ProductShelfLife < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'ProductShelfLife.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/SampledData.rb | Ruby | apache-2.0 | 92 | master | 1,519 | module FHIR
module R4
class SampledData < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'SampledData.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Sampled... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/CodeableConcept.rb | Ruby | apache-2.0 | 92 | master | 840 | module FHIR
module R4
class CodeableConcept < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'CodeableConcept.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/ContactDetail.rb | Ruby | apache-2.0 | 92 | master | 840 | module FHIR
module R4
class ContactDetail < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'ContactDetail.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Con... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Count.rb | Ruby | apache-2.0 | 92 | master | 1,313 | module FHIR
module R4
class Count < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Count.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Count.extension', '... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Population.rb | Ruby | apache-2.0 | 92 | master | 1,664 | module FHIR
module R4
class Population < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
MULTIPLE_TYPES = {
'age' => ['Range', 'CodeableConcept']
}
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Population.id', 'min'... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Address.rb | Ruby | apache-2.0 | 92 | master | 2,180 | module FHIR
module R4
class Address < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Address.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Address.extensi... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/r4/generated/types/Money.rb | Ruby | apache-2.0 | 92 | master | 2,160 | module FHIR
module R4
class Money < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml
SEARCH_PARAMS = []
METADATA = {
'id' => {'type'=>'string', 'path'=>'Money.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Money.extension', '... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/fhir_ext/structure_definition_finding.rb | Ruby | apache-2.0 | 92 | master | 1,736 | module FHIR
class StructureDefinitionFinding
# This is not an official FHIR Resource type. It is a data structure used for reporting.
attr_accessor :resourceType
attr_accessor :profileIdA
attr_accessor :profileIdB
attr_accessor :status
attr_accessor :path
attr_accessor :attribute
attr_... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/fhir_ext/common_structure_definition.rb | Ruby | apache-2.0 | 92 | master | 17,747 | # Extend StructureDefinition for profile validation code
require 'nokogiri'
require 'yaml'
require 'bcp47'
module FHIR
module CommonStructureDefinition
extend FHIR::Deprecate
attr_accessor :finding
attr_accessor :errors
attr_accessor :warnings
attr_accessor :hierarchy
def self.included(base... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/fhir_ext/common_element_definition.rb | Ruby | apache-2.0 | 92 | master | 1,354 | module FHIR
module CommonElementDefinition
# children is used to hierarchically arrange elements
# so profile validation is easier to compute
attr_accessor :children
attr_accessor :local_name
attr_accessor :marked_for_keeping
def add_descendent(element)
@children = [] if @children.nil?
... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/fhir_ext/common_structure_definition_compare.rb | Ruby | apache-2.0 | 92 | master | 17,401 | module FHIR
# Extend StructureDefinition for profile comparison code
module CommonStructureDefinitionCompare
extend FHIR::Deprecate
# -------------------------------------------------------------------------
# Profile Comparison
# -----------------------------------------... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/tasks/tasks.rake | Ruby | apache-2.0 | 92 | master | 6,741 | require 'fhir_models'
namespace :fhir do
desc 'console'
task :console, [] do |_t, _args|
sh 'bin/console'
end
desc 'generate fhir models'
task :generate, [] do |_t, _args|
require_relative '../generator/generator'
FHIR::Generator.generate
end
desc 'preprocess definitions'
task :preprocess,... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/bootstrap/xml.rb | Ruby | apache-2.0 | 92 | master | 4,797 | require 'nokogiri'
module FHIR
module ClassXml
def from_xml(xml)
doc = Nokogiri::XML(xml)
doc.root.add_namespace_definition('f', 'http://hl7.org/fhir')
doc.root.add_namespace_definition('x', 'http://www.w3.org/1999/xhtml')
hash = xml_node_to_hash(doc.root)
resource = nil
begin... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/bootstrap/model.rb | Ruby | apache-2.0 | 92 | master | 14,114 | require 'nokogiri'
require 'mime/types'
require 'yaml'
require 'bcp47'
require_relative '../r4/bootstrap/definitions'
module FHIR
class Model
extend FHIR::Deprecate
def initialize(hash = {})
from_hash(hash)
self.class::METADATA.each do |key, value|
local_name = key
local_name = va... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/bootstrap/field.rb | Ruby | apache-2.0 | 92 | master | 829 | module FHIR
class Field
include FHIR::Hashable
attr_accessor :name
attr_accessor :local_name
attr_accessor :path
attr_accessor :type
attr_accessor :type_profiles
attr_accessor :min
attr_accessor :max
attr_accessor :valid_codes
attr_accessor :binding
attr_accessor :regex
... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/bootstrap/common_definitions.rb | Ruby | apache-2.0 | 92 | master | 4,837 | require 'tempfile'
require_relative '../generator/ig_loader'
module FHIR
module CommonDefinitions
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
extend FHIR::Deprecate
def ig_resources
@ig_resources ||= @ig_loader.load
end
def cache
... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/bootstrap/json.rb | Ruby | apache-2.0 | 92 | master | 708 | require 'json'
module FHIR
module ClassJson
#
# This module includes methods to serialize or deserialize FHIR resources to and from JSON.
#
def from_json(json)
hash = JSON.parse(json)
resource = nil
begin
resource_type = hash['resourceType']
klass = versioned_fhir_... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/bootstrap/preprocess.rb | Ruby | apache-2.0 | 92 | master | 6,280 | require 'nokogiri'
module FHIR
module Boot
class Preprocess
def self.pre_process_bundle(filename)
# Read the file
puts "Processing #{File.basename(filename)}..."
start = File.size(filename)
json = File.open(filename, 'r:UTF-8', &:read)
hash = JSON.parse(json)
... |
github | inferno-framework/fhir_models | https://github.com/inferno-framework/fhir_models | lib/fhir_models/bootstrap/hashable.rb | Ruby | apache-2.0 | 92 | master | 5,133 | require 'bigdecimal'
module FHIR
module Hashable
def to_hash
hash = {}
self.class::METADATA.each do |key, value|
local_name = key
local_name = value['local_name'] if value['local_name']
hash[key] = instance_variable_get("@#{local_name}")
if hash[key].respond_to?(:to_has... |
github | kddnewton/rails-pattern_matching | https://github.com/kddnewton/rails-pattern_matching | Rakefile | Ruby | mit | 92 | main | 460 | # frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
require "syntax_tree/rake_tasks"
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList["test/*_test.rb"]
t.verbose = true
end
task default: :test
configure = ->(task) do
task.source_files =
FileList[%w[Gemfile... |
github | kddnewton/rails-pattern_matching | https://github.com/kddnewton/rails-pattern_matching | rails-pattern_matching.gemspec | Ruby | mit | 92 | main | 989 | # frozen_string_literal: true
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "rails/pattern_matching/version"
Gem::Specification.new do |spec|
spec.name = "rails-pattern_matching"
spec.version = Rails::PatternMatching::VERSION
spec.authors = ["Kevin Ne... |
github | kddnewton/rails-pattern_matching | https://github.com/kddnewton/rails-pattern_matching | test/pattern_matching_test.rb | Ruby | mit | 92 | main | 2,036 | # frozen_string_literal: true
require "test_helper"
class PatternMatchingTest < Test::Unit::TestCase
test "model" do
person = Person.new
person.name = "Rails"
assert_equal({ name: "Rails" }, person.deconstruct_keys([:name]))
end
test "model **" do
person = Person.new
person.name = "Rails"
... |
github | kddnewton/rails-pattern_matching | https://github.com/kddnewton/rails-pattern_matching | test/test_helper.rb | Ruby | mit | 92 | main | 727 | # frozen_string_literal: true
require "bundler/setup"
require "rails/pattern_matching"
require "test-unit"
ActiveRecord::Base.establish_connection(
adapter: "sqlite3",
database: ":memory:"
)
ActiveRecord::Base.logger = Logger.new("/dev/null")
ActiveRecord::Schema.define do
create_table :posts, force: true do ... |
github | kddnewton/rails-pattern_matching | https://github.com/kddnewton/rails-pattern_matching | lib/rails/pattern_matching.rb | Ruby | mit | 92 | main | 7,032 | # frozen_string_literal: true
require "active_model"
require "active_record"
require "action_controller"
require "rails/pattern_matching/version"
module Rails
module PatternMatching
# This error is raised when the pattern matching behavior is already
# defined in a class or module that we're trying to exten... |
github | r7kamura/jdoc | https://github.com/r7kamura/jdoc | jdoc.gemspec | Ruby | mit | 92 | master | 1,057 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "jdoc/version"
Gem::Specification.new do |spec|
spec.name = "jdoc"
spec.version = Jdoc::VERSION
spec.authors = ["Ryo Nakamura"]
spec.email = ["r7kamura@gmail.com"]
spec.summ... |
github | r7kamura/jdoc | https://github.com/r7kamura/jdoc | lib/jdoc.rb | Ruby | mit | 92 | master | 377 | require "active_support/core_ext/object/to_query"
require "active_support/core_ext/string/inflections"
require "cgi"
require "erubis"
require "json_schema"
require "redcarpet"
require "rack"
require "uri"
require "jdoc/generator"
require "jdoc/link"
require 'jdoc/request/multipart'
require "jdoc/property"
require "jdo... |
github | r7kamura/jdoc | https://github.com/r7kamura/jdoc | lib/jdoc/generator.rb | Ruby | mit | 92 | master | 2,830 | module Jdoc
class Generator
DEFAULT_HTML_TEMPLATE_PATH = File.expand_path("../../../template.html.erb", __FILE__)
DEFAULT_MARKDOWN_TEMPLATE_PATH = File.expand_path("../../../template.md.erb", __FILE__)
# Utility wrapper for Jdoc::Generator#call
# @return [String]
def self.call(*args, **kwargs)
... |
github | r7kamura/jdoc | https://github.com/r7kamura/jdoc | lib/jdoc/link.rb | Ruby | mit | 92 | master | 8,254 | module Jdoc
class Link
# @param link [JsonSchema::Schema::Link]
def initialize(link)
@raw_link = link
end
# @return [String] method + path
# @example
# link.endpoint #=> "GET /apps"
def endpoint
"#{method} #{path}"
end
# Responds to .sort method
# @return [Fixnu... |
github | r7kamura/jdoc | https://github.com/r7kamura/jdoc | lib/jdoc/schema.rb | Ruby | mit | 92 | master | 1,889 | module Jdoc
class Schema
DEFAULT_ENDPOINT = "https://api.example.com"
# @param schema [Hash] JSON Schema
def initialize(schema)
@json_schema = JsonSchema.parse!(schema).tap(&:expand_references!)
end
# @return [Array<Jdoc::Resource>] All top-level properties in its title order
def resou... |
github | r7kamura/jdoc | https://github.com/r7kamura/jdoc | lib/jdoc/resource.rb | Ruby | mit | 92 | master | 1,543 | module Jdoc
class Resource
attr_reader :schema
# @param schema [JsonSchema::Schema]
def initialize(schema)
@schema = schema
end
# @return [String] Description for this schema, defined in description property
# @example
# resource.description #=> "An app is a program to be deploye... |
github | r7kamura/jdoc | https://github.com/r7kamura/jdoc | lib/jdoc/property.rb | Ruby | mit | 92 | master | 1,414 | module Jdoc
class Property
attr_reader :name
# @param name [String]
# @param schema [JsonSchema::Schema]
def initialize(name: nil, schema: nil)
@name = name
@schema = schema
end
# @return [Hash] Key-Value pair of metadata of this property
def options
{
Example: ... |
github | r7kamura/jdoc | https://github.com/r7kamura/jdoc | lib/jdoc/request/multipart.rb | Ruby | mit | 92 | master | 1,071 | module Jdoc
module Request
class Multipart
MULTIPART_BOUNDARY = "---BoundaryX"
# @return [String] returns boundary parameter for multipart content-type
def self.boundary
"boundary=#{MULTIPART_BOUNDARY}"
end
# @param params [Hash] request parameters
def initialize(para... |
github | r7kamura/jdoc | https://github.com/r7kamura/jdoc | spec/jdoc/generator_spec.rb | Ruby | mit | 92 | master | 862 | require "spec_helper"
require "active_support/core_ext/string/strip"
require "yaml"
describe Jdoc::Generator do
describe ".call" do
subject do
described_class.call(schema)
end
let(:schema) do
YAML.load_file(schema_path)
end
let(:schema_path) do
File.expand_path("../../fixtures... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | qbo_api.gemspec | Ruby | mit | 92 | master | 1,340 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'qbo_api/version'
Gem::Specification.new do |spec|
spec.name = "qbo_api"
spec.version = QboApi::VERSION
spec.authors = ["Christian Pelczarski"]
spec.email = ["... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | spec/qbo_api_spec.rb | Ruby | mit | 92 | master | 2,278 | require 'spec_helper'
describe QboApi do
let(:api){ QboApi.new(creds) }
it 'has a version number' do
expect(QboApi::VERSION).not_to be nil
end
it '.snake_to_camel' do
res = %w(SalesReceipt CreditMemo Customer)
%i(sales_receipt credit_memo customer).each_with_index do |s, index|
expect(api.s... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | spec/api_methods_spec.rb | Ruby | mit | 92 | master | 8,049 | require 'spec_helper'
describe QboApi::ApiMethods do
let(:api) { QboApi.new(creds) }
QboApi.send(:public, :to_quote_or_not)
describe "get, filtered get, and query" do
it '.to_quote_or_not' do
['true', 'false', 'CURRENT_DATE', '( true, false)'].each do |str|
expect(api.to_quote_or_not(str)).t... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | spec/util_spec.rb | Ruby | mit | 92 | master | 2,528 | require 'spec_helper'
describe QboApi::Util do
let(:api){ QboApi.new(creds) }
it 'allow string to pass thru cdc_time' do
expect(api.cdc_time("str")).to eq "str"
end
it 'convert Time objects to proper CDC "changed since" time stamp' do
expect(api.cdc_time(Time.now)).to match /^\d{4}-\d{2}-\d{2}T\d{2}:... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | spec/spec_helper.rb | Ruby | mit | 92 | master | 2,795 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'qbo_api'
require 'rspec'
require 'webmock/rspec'
require 'vcr'
require 'amazing_print'
require_relative 'support/credentials'
VCR.configure do |config|
config.cassette_library_dir = File.expand_path("../vcr", __FILE__)
config.hook_into :webmock
... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | spec/error_spec.rb | Ruby | mit | 92 | master | 1,679 | require 'spec_helper'
describe "QboApi Error handling" do
let(:api){ QboApi.new(creds) }
it 'handles a 401 error' do
# Wait until access_token expires to re-run
use_cassette("error/401") do
expect {
response = api.get :customer, 1
}.to raise_error QboApi::Unauthorized
end
end
... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | spec/attachment_spec.rb | Ruby | mit | 92 | master | 2,070 | require 'spec_helper'
describe "QboApi Attachment" do
let(:api){ QboApi.new(creds) }
it 'for an invoice is successfully created' do
payload = {
"AttachableRef":
[
{"EntityRef":
{
"type": "Invoice",
"value": "75"
}
... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | spec/supporting_spec.rb | Ruby | mit | 92 | master | 3,930 | require 'spec_helper'
describe "QboApi::Supporting" do
let(:api){ QboApi.new(creds) }
context ".cdc" do
it 'should grab estimates via change data capture query', skip: with_cannot_match_cassette_error do
use_cassette("cdc/basic") do
response = api.cdc(entities: 'estimate', changed_since: '2011-1... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api.rb | Ruby | mit | 92 | master | 1,831 | require 'qbo_api/version'
require 'json'
require 'uri'
require 'securerandom'
require 'logger'
require_relative 'qbo_api/configuration'
require_relative 'qbo_api/connection'
require_relative 'qbo_api/supporting'
require_relative 'qbo_api/error'
require_relative 'qbo_api/raise_http_exception'
require_relative 'qbo_api/e... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api/raise_http_exception.rb | Ruby | mit | 92 | master | 2,818 | require 'faraday'
require 'faraday/response'
require 'nokogiri'
# @private
class QboApi
# @private
class RaiseHttpException < Faraday::Response::RaiseError
def on_complete(env)
case env[:status]
when 400
raise QboApi::BadRequest.new(error_message(env))
when 401
raise QboApi::Un... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api/error.rb | Ruby | mit | 92 | master | 2,455 | #200 OK The request succeeded. However, the response body may contain a <Fault> element, indicating an error.
#400 Bad request Generally, the request cannot be fulfilled due to bad syntax. In some cases, this response code is returned for a request with bad authorization data.
#401 Unauthorized Authentication or autho... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api/configuration.rb | Ruby | mit | 92 | master | 621 | class QboApi
module Configuration
def logger
@logger ||= ::Logger.new($stdout)
end
def logger=(logger)
@logger = logger
end
def log
@log ||= false
end
def log=(value)
@log = value
end
def production
@production ||= false
end
def production... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api/supporting.rb | Ruby | mit | 92 | master | 1,243 | class QboApi
module Supporting
def cdc(entities:, changed_since:)
path = "#{realm_id}/cdc"
path = add_params_to_path(path: path, params: { entities: entities, changedSince: cdc_time(changed_since) })
request(:get, path: path)
end
def batch(payload)
path = "#{realm_id}/batch"
... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api/connection.rb | Ruby | mit | 92 | master | 3,793 | require 'faraday'
require 'faraday/response/json'
require 'qbo_api/raise_http_exception'
require 'faraday/detailed_logger'
require 'faraday/multipart'
class QboApi
module Connection
def authorized_json_connection(url, headers: nil)
headers ||= {}
headers['Accept'] ||= 'application/json'
headers... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api/util.rb | Ruby | mit | 92 | master | 1,235 | class QboApi
module Util
attr_writer :minor_version
def minor_version
@minor_version || QboApi.minor_version
end
def esc(query)
query.gsub("'", "\\\\'")
end
def cdc_time(time)
if time.is_a?(String)
time
else
time.iso8601
end
end
def uui... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api/entity.rb | Ruby | mit | 92 | master | 2,129 | class QboApi
module Entity
def singular(entity)
e = snake_to_camel(entity)
case e
when 'Classes', 'Class'
'Class'
when 'Entitlements', 'Preferences'
e
else
e.chomp('s')
end
end
def entity_path(entity)
"#{realm_id}/#{singular(entity).downca... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api/api_methods.rb | Ruby | mit | 92 | master | 5,296 | class QboApi
module ApiMethods
def all(entity, max: 1000, select: nil, inactive: false, params: nil, &block)
enumerator = create_all_enumerator(entity, max: max, select: select,
inactive: inactive, params: params)
if block_given?
enumerator.each(&block)... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | lib/qbo_api/attachment.rb | Ruby | mit | 92 | master | 1,323 | class QboApi
module Attachment
def read_attachment(id:)
raw_response = connection.get do |request|
request.url "#{realm_id}/attachable/#{id}"
end
response(raw_response, entity: :attachable)
end
def upload_attachment(payload:, attachment:)
content_type = payload['ContentTyp... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | example/base.rb | Ruby | mit | 92 | master | 1,228 | BASE_GEMS = proc do
gem 'qbo_api', path: '.'
# This app
gem 'sinatra'
gem 'sinatra-contrib'
gem 'puma'
# Creds from ../.env
gem 'dotenv'
end
BASE_SETUP = proc do
# Webhook support
require 'json'
require 'openssl'
require 'base64'
Dotenv.load "#{__dir__}/../.env"
end
BASE_APP_CONFIG = proc do... |
github | minimul/qbo_api | https://github.com/minimul/qbo_api | example/oauth2.rb | Ruby | mit | 92 | master | 1,969 | require 'bundler/inline'
require File.expand_path(File.join('..', 'base'), __FILE__)
install_gems = true
gemfile(install_gems) do
source 'https://rubygems.org'
instance_eval(&BASE_GEMS)
gem 'rack-oauth2'
end
instance_eval(&BASE_SETUP)
class OAuth2App < Sinatra::Base
instance_eval(&BASE_APP_CONFIG)
CLIE... |
github | jekyll/jekyll-avatar | https://github.com/jekyll/jekyll-avatar | jekyll-avatar.gemspec | Ruby | mit | 92 | main | 1,037 | # frozen_string_literal: true
require_relative "lib/jekyll-avatar/version"
Gem::Specification.new do |spec|
spec.name = "jekyll-avatar"
spec.version = Jekyll::Avatar::VERSION
spec.authors = ["Ben Balter"]
spec.email = ["ben.balter@github.com"]
spec.summary = "A Jekyll plu... |
github | jekyll/jekyll-avatar | https://github.com/jekyll/jekyll-avatar | lib/jekyll-avatar.rb | Ruby | mit | 92 | main | 3,821 | # frozen_string_literal: true
require "zlib"
module Jekyll
class Avatar < Liquid::Tag
def self.generate_template_with(keys)
attrs = (BASE_ATTRIBUTES + keys).map! { |key| %(#{key}="%<#{key}>s") }.join(" ")
"<img #{attrs} />"
end
private_class_method :generate_template_with
#
SERVERS... |
github | jekyll/jekyll-avatar | https://github.com/jekyll/jekyll-avatar | spec/spec_helper.rb | Ruby | mit | 92 | main | 1,278 | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "jekyll"
require "jekyll-avatar"
require "rspec-html-matchers"
TEST_DIR = File.dirname(__FILE__)
TMP_DIR = File.expand_path("../tmp", TEST_DIR)
RSpec.configure do |config|
config.include RSpecHtmlMatchers
end
def doc_wi... |
github | jekyll/jekyll-avatar | https://github.com/jekyll/jekyll-avatar | spec/jekyll/avatar_spec.rb | Ruby | mit | 92 | main | 6,627 | # frozen_string_literal: true
require "spec_helper"
describe Jekyll::Avatar do
subject { described_class.parse "avatar", text, tokenizer, parse_context }
let(:doc) { doc_with_content(content) }
let(:username) { "hubot" }
let(:args) { "" }
let(:text) { "#{username} #{args}".squeeze(" ") }
let(:content) { ... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | govuk_design_system_formbuilder.gemspec | Ruby | mit | 92 | main | 2,476 | $LOAD_PATH.push File.expand_path('lib', __dir__)
require "govuk_design_system_formbuilder/version"
require_relative "util/version_formatter"
METADATA = {
"bug_tracker_uri" => "https://github.com/x-govuk/govuk-form-builder/issues",
"changelog_uri" => "https://github.com/x-govuk/govuk-form-builder/releases",
... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/spec_helper.rb | Ruby | mit | 92 | main | 5,432 | require 'rspec-html-matchers'
require 'action_controller'
require 'action_view'
require 'active_model'
require 'active_support'
require 'active_support/core_ext/string'
require 'ostruct'
require 'debug'
require 'simplecov'
if ENV.fetch('SIMPLECOV') { '1' } == '1'
SimpleCov.start
end
Dir[File.join('./spec', 'support... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/utility.rb | Ruby | mit | 92 | main | 764 | # Convert a hash containing supplied and expected contents
# into either supplied or expected
#
# args = { placeholder: { provided: 'Seymour Skinner', output: 'Seymour Skinner' } }
# extract_args(args, :output)
#
# => { placeholder: 'Seymour Skinner' }
#
def extract_args(args, subkey)
args.each.with_object({}) { |(k,... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/localisation.rb | Ruby | mit | 92 | main | 380 | DEFAULT_LOCALE = :en
def with_localisations(localisations, locale: DEFAULT_LOCALE)
unless locale.eql?(DEFAULT_LOCALE)
I18n.available_locales = [DEFAULT_LOCALE, locale]
I18n.locale = locale
end
I18n.backend.store_translations(locale, localisations[locale])
yield
ensure
I18n.available_locales = DEFAUL... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/examples.rb | Ruby | mit | 92 | main | 3,773 | class Project
include ActiveModel::Model
attr_accessor(:id, :name, :description)
end
class Stationery
include ActiveModel::Model
attr_accessor(:id, :name, :description)
end
class Being
attr_accessor(
:name,
:born_on,
:born_at,
:gender,
:over18,
:favourite_colour,
:favourite_colou... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/matchers.rb | Ruby | mit | 92 | main | 2,600 | require 'rspec/expectations'
RSpec::Matchers.define(:have_root_element_with_class) do |class_name|
# We're using xpath here because there's no sane way (ie without wrapping
# everything in a useless element just for testing) of checking that elements
# appear at the root of the fragment
#
# Note that the ./*... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/setup_examples.rb | Ruby | mit | 92 | main | 1,852 | shared_context 'setup examples' do
let(:red_option) { OpenStruct.new(id: 'red', name: 'Red') }
let(:blue_option) { OpenStruct.new(id: 'blue', name: 'Blue') }
let(:green_option) { OpenStruct.new(id: 'green', name: 'Green') }
let(:yellow_option) { OpenStruct.new(id: 'yellow', name: 'Yellow') }
let(:colours) { [... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_supports_branding_examples.rb | Ruby | mit | 92 | main | 531 | shared_examples 'a field that supports custom branding' do
let(:default_brand) { 'govuk' }
let(:custom_brand) { 'globex-corp' }
before do
GOVUKDesignSystemFormBuilder.configure do |conf|
conf.brand = custom_brand
end
end
after { GOVUKDesignSystemFormBuilder.reset! }
specify 'should contain ... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_text_field_examples.rb | Ruby | mit | 92 | main | 6,466 | shared_examples 'a regular input' do |method_identifier, field_type|
let(:attribute) { :name }
let(:label_text) { 'Full name' }
let(:hint_text) { 'It says it on your passport' }
let(:method) { "govuk_#{method_identifier}_field".to_sym }
let(:args) { [method, attribute] }
subject { builder.send(*args, label:... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/setup_radios.rb | Ruby | mit | 92 | main | 213 | shared_context 'setup radios' do
let(:field_type) { %s(input[type='radio']) }
let(:aria_described_by_target) { 'fieldset' }
let(:attribute) { :favourite_colour }
let(:label_text) { 'Cherished shade' }
end |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_label_examples.rb | Ruby | mit | 92 | main | 4,774 | shared_examples 'a field that supports labels' do
context 'when a label is provided' do
subject { builder.send(*args, label: { text: label_text }) }
specify 'the label should be included' do
expect(subject).to have_tag('label', with: { class: 'govuk-label' }, text: label_text)
end
specify 'the... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_error_summary_examples.rb | Ruby | mit | 92 | main | 722 | shared_examples 'an error summary linking directly to a form element' do |method, element|
let(:identifier) { 'person-name-field-error' }
let(:element) { element || 'input' }
let(:object) { Person.new(name: nil) }
subject do
builder.safe_join(
[
builder.govuk_error_summary,
builder.se... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_html_attribute_examples.rb | Ruby | mit | 92 | main | 5,800 | shared_examples 'a field that allows extra HTML attributes to be set' do
let(:example_block) { proc { builder.tag.span('block text') } }
context 'with args in the expected formats' do
sample_json = { e: 'f', g: %w(h i j) }.to_json
custom_attributes = {
required: { provided: true, ... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_html_formatting_examples.rb | Ruby | mit | 92 | main | 337 | shared_examples 'HTML formatting checks' do
specify 'no attributes have leading or trailing spaces' do
expect(subject.scan(%r(="(.*?)")).flatten).to all(have_no_leading_or_trailing_spaces)
end
specify 'no attributes have double spaces' do
expect(subject.scan(%r(="(.*?)")).flatten).to all(have_no_double_s... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_plain_ruby_object_examples.rb | Ruby | mit | 92 | main | 1,243 | class Biscuit
attr_accessor :name, :weight, :calories, :expires_on, :expires_at
def initialize(name, weight, calories, expires_on = Date.today.next_year, expires_at: Time.now)
self.name = name
self.weight = weight
self.calories = calories
self.expires_on = expires_on
self.expires_at... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_hint_examples.rb | Ruby | mit | 92 | main | 3,522 | shared_examples 'a field that supports hints' do
context 'when a hint is provided as a string' do
subject { builder.send(*args, hint: { text: hint_text }) }
specify 'output should contain a hint' do
expect(subject).to have_tag('div', with: { class: 'govuk-form-group' }) do
with_tag('div', text:... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_caption_examples.rb | Ruby | mit | 92 | main | 4,458 | shared_examples 'a field that supports captions' do |captioned_element|
let(:caption_text) { 'Stage 3' }
let(:caption_class) { %(govuk-caption-#{caption_size}) }
let(:caption_size) { 'l' }
let(:caption_args) { { text: caption_text, size: caption_size } }
subject { builder.send(*args, caption: caption_args, *... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_block_examples.rb | Ruby | mit | 92 | main | 1,449 | shared_examples 'a field that accepts arbitrary blocks of HTML' do
let(:block_h1) { 'The quick brown fox' }
let(:block_h2) { 'Jumped over the' }
let(:block_p) { 'Lazy dog.' }
context 'when a block is supplied' do
subject do
builder.send(*args) do
builder.safe_join(
[builder.tag.h1(b... |
github | x-govuk/govuk-form-builder | https://github.com/x-govuk/govuk-form-builder | spec/support/shared/shared_content_before_and_after_input_examples.rb | Ruby | mit | 92 | main | 1,293 | shared_examples 'a field that supports adding content before and after inputs' do
# let(:before_key) { defined?(before_inputs) ? before_inputs : :before_input }
# let(:after_key) { defined?(after_inputs) ? after_inputs : :after_input }
let(:before_key) do
if defined?(multiple_inputs) && multiple_inputs
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.