Sha256: 79f729803f8af248c6b88c7cec160e8290da570cda9c1899265f33052d8f3466

Contents?: true

Size: 598 Bytes

Versions: 22

Compression:

Stored size: 598 Bytes

Contents

module Garage
  module Docs
    class Example
      def self.build_all(controller, examples)
        examples.compact.map do |resource|
          new(resource, controller)
        end
      end

      def initialize(resource, controller)
        @resource, @controller = resource, controller
      end

      def url
        if @resource.is_a?(String)
          @resource
        elsif @resource.respond_to?(:to_proc)
          @resource.to_proc.call(@controller.main_app)
        else
          @resource.represent!
          @resource.link_path_for(:self)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
the_garage-2.8.2 lib/garage/docs/example.rb
the_garage-2.8.1 lib/garage/docs/example.rb
the_garage-2.8.0 lib/garage/docs/example.rb
the_garage-2.7.0 lib/garage/docs/example.rb
the_garage-2.6.1 lib/garage/docs/example.rb
the_garage-2.6.0 lib/garage/docs/example.rb
the_garage-2.5.0 lib/garage/docs/example.rb
the_garage-2.4.4 lib/garage/docs/example.rb
the_garage-2.4.3 lib/garage/docs/example.rb
the_garage-2.4.2 lib/garage/docs/example.rb
the_garage-2.4.1 lib/garage/docs/example.rb
the_garage-2.4.0 lib/garage/docs/example.rb
the_garage-2.3.3 lib/garage/docs/example.rb
the_garage-2.3.2 lib/garage/docs/example.rb
the_garage-2.3.1 lib/garage/docs/example.rb
the_garage-2.3.0 lib/garage/docs/example.rb
the_garage-2.2.0 lib/garage/docs/example.rb
the_garage-2.1.0 lib/garage/docs/example.rb
the_garage-2.0.3 lib/garage/docs/example.rb
the_garage-2.0.2 lib/garage/docs/example.rb