Exception: Graphiti::Errors::AttributeError
- Defined in:
- lib/graphiti/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#exists ⇒ Object
readonly
Returns the value of attribute exists.
-
#flag ⇒ Object
readonly
Returns the value of attribute flag.
-
#guard ⇒ Object
readonly
Returns the value of attribute guard.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
- #action ⇒ Object
-
#initialize(resource, name, flag, **opts) ⇒ AttributeError
constructor
A new instance of AttributeError.
- #message ⇒ Object
- #resource_name ⇒ Object
Constructor Details
#initialize(resource, name, flag, **opts) ⇒ AttributeError
Returns a new instance of AttributeError.
340 341 342 343 344 345 |
# File 'lib/graphiti/errors.rb', line 340 def initialize(resource, name, flag, **opts) @resource = resource @name = name @flag = flag @request = opts[:request] || false end |
Instance Attribute Details
#exists ⇒ Object (readonly)
Returns the value of attribute exists.
333 334 335 |
# File 'lib/graphiti/errors.rb', line 333 def exists @exists end |
#flag ⇒ Object (readonly)
Returns the value of attribute flag.
333 334 335 |
# File 'lib/graphiti/errors.rb', line 333 def flag @flag end |
#guard ⇒ Object (readonly)
Returns the value of attribute guard.
333 334 335 |
# File 'lib/graphiti/errors.rb', line 333 def guard @guard end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
333 334 335 |
# File 'lib/graphiti/errors.rb', line 333 def name @name end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
333 334 335 |
# File 'lib/graphiti/errors.rb', line 333 def request @request end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
333 334 335 |
# File 'lib/graphiti/errors.rb', line 333 def resource @resource end |
Instance Method Details
#action ⇒ Object
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'lib/graphiti/errors.rb', line 347 def action if @request { sortable: "sort on", filterable: "filter on", readable: "read", writable: "write" }[@flag] else { sortable: "add sort", filterable: "add filter", readable: "read", writable: "write" }[@flag] end end |
#message ⇒ Object
374 375 376 |
# File 'lib/graphiti/errors.rb', line 374 def "#{resource_name}: Tried to #{action} attribute #{@name.inspect}" end |