Sha256: f879fca69afbbab2084f0489ecde1929ed4e8fa2480dcd28de56e5e425af4ddb

Contents?: true

Size: 367 Bytes

Versions: 8

Compression:

Stored size: 367 Bytes

Contents

# frozen_string_literal: true

class WCC::Contentful::Model::Redirect < WCC::Contentful::Model
  def href
    if !url.nil?
      url
    elsif valid_page_reference?(pageReference)
      "/#{pageReference.url}"
    end
  end

  def valid_page_reference?(page_ref)
    if !page_ref.nil? && !defined?(page_ref.url).nil?
      true
    else
      false
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
wcc-contentful-app-0.4.0.pre.rc lib/wcc/contentful/model/redirect.rb
wcc-contentful-app-0.4.0.pre.alpha lib/wcc/contentful/model/redirect.rb
wcc-contentful-0.3.0 lib/wcc/contentful/model/redirect.rb
wcc-contentful-app-0.3.0.pre.rc3 lib/wcc/contentful/model/redirect.rb
wcc-contentful-app-0.3.0.pre.rc2 lib/wcc/contentful/model/redirect.rb
wcc-contentful-app-0.3.0.pre.rc lib/wcc/contentful/model/redirect.rb
wcc-contentful-app-0.2.2 lib/wcc/contentful/model/redirect.rb
wcc-contentful-0.2.2 lib/wcc/contentful/model/redirect.rb