class ArSerializer::GraphQL::ScalarTypeClass
Public Class Methods
new(type)
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 178 def initialize(type) @type = type end
Public Instance Methods
collect_types(types)
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 203 def collect_types(types) types[name] = true end
gql_type()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 207 def gql_type type end
kind()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 182 def kind 'SCALAR' end
name()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 186 def name case type when String, :string :string when Integer, :int :int when Float, :float :float when true, false, :boolean :boolean when :other :other else :any end end
sample()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 211 def sample case ts_type when 'number' 0 when 'string' '' when 'boolean' true when 'any' nil else type end end
ts_type()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 226 def ts_type case type when :int, :float 'number' when :string, :number, :boolean type.to_s when Symbol 'any' else type.to_json end end