Class: GraphQL::Client::Schema::EnumType::EnumValue
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
String
|
|
Instance Chain:
self,
String
|
|
Inherits: |
String
|
Defined in: | lib/graphql/client/schema/enum_type.rb |
Class Method Summary
- .new(obj, enum_value, enum) ⇒ EnumValue constructor
Instance Method Summary
Constructor Details
.new(obj, enum_value, enum) ⇒ EnumValue
# File 'lib/graphql/client/schema/enum_type.rb', line 13
def initialize(obj, enum_value, enum) super(obj) @enum_value = enum_value @enum = enum end
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args)
[ GitHub ]# File 'lib/graphql/client/schema/enum_type.rb', line 27
def method_missing(method_name, *args) if method_name[-1] == "?" queried_value = method_name[0..-2] if @enum.include?(queried_value) raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 0)" unless args.empty? return @enum_value == queried_value end end super end
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
# File 'lib/graphql/client/schema/enum_type.rb', line 19
def respond_to_missing?(method_name, include_private = false) if method_name[-1] == "?" && @enum.include?(method_name[0..-2]) true else super end end