Module: Pacer::PacerGraph::ElementType
- Included in:
- Pacer::PacerGraph
- Defined in:
- lib/pacer/graph/pacer_graph.rb
Instance Method Summary collapse
- #element_type(et = nil) ⇒ Object
-
#element_type?(et) ⇒ Boolean
Is the element type given supported by this graph?.
Instance Method Details
#element_type(et = nil) ⇒ Object
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File 'lib/pacer/graph/pacer_graph.rb', line 440 def element_type(et = nil) return nil unless et result = case et when :vertex, Pacer::Vertex :vertex when :edge, Pacer::Edge :edge when :mixed, Pacer::Element :mixed when :object :object else if et == Object :object elsif et == index_class(:vertex) :vertex elsif et == index_class(:edge) :edge end end if result result else raise ArgumentError, 'Element type may be one of :vertex, :edge, :mixed or :object' end end |
#element_type?(et) ⇒ Boolean
Is the element type given supported by this graph?
436 437 438 |
# File 'lib/pacer/graph/pacer_graph.rb', line 436 def element_type?(et) [:vertex, :edge, :mixed].include? element_type(et) end |