Sha256: 3f8f0172e63a5af3367d3945992ece5e03795a4274bec60ab2d8ab0bf0435b47

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

# Extends the Array class to include a method that converts an array to an ObjectPath
class Array
  # Converts an array to an ObjectPath
  #
  # +Returns_ (ObjectPaths::ObjectPath) = the ObjectPath representation of the array
  #
  # Example:
  #   %w[sub_model the_answer].to_object_path
  #   # => #<ObjectPaths::ObjectPath:0x00007f8f9b0b3b08 @path_steps=["sub_model", "the_answer"]>
  #
  # _See_ *ObjectPaths::ObjectPath*
  def to_object_path
    ObjectPaths::ObjectPath.new(self)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
object_path-1.0.2 lib/array_object_path.rb
object_path-1.0.1 lib/array_object_path.rb
object_path-1.0.0 lib/array_object_path.rb