class Graphlyte::Arguments::Value

Attributes

value[R]

Public Class Methods

new(value) click to toggle source
# File lib/graphlyte/arguments/value.rb, line 9
def initialize(value)
  raise ArgumentError, "Hash not allowed in this context" if value.is_a? Hash
  @value = value
end

Public Instance Methods

formal?() click to toggle source
# File lib/graphlyte/arguments/value.rb, line 18
def formal?
  value.is_a? Schema::Types::Base
end
symbol?() click to toggle source
# File lib/graphlyte/arguments/value.rb, line 14
def symbol?
  value.is_a? Symbol
end
to_s() click to toggle source
# File lib/graphlyte/arguments/value.rb, line 22
def to_s
  return "$#{value.to_s.to_camel_case}" if value.is_a? Symbol
  return value if value.is_a? Numeric
  return "\"#{value}\"" if value.is_a? String
  return "null" if value.nil?
  return "$#{value.placeholder.to_camel_case}" if value.is_a? Schema::Types::Base
  value.to_s
end