Top Level Namespace

Defined Under Namespace

Modules: RFacebook

Constant Summary collapse

FACEBOOK =
yamlFile[RAILS_ENV]

Instance Method Summary collapse

Instance Method Details

#ensureLeadingAndTrailingSlashesForPath(path) ⇒ Object

make sure the paths have leading and trailing slashes



124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/rfacebook_on_rails/plugin/init.rb', line 124

def ensureLeadingAndTrailingSlashesForPath(path)
  if (path and path.size>0)
    if !path.starts_with?("/")
      path = "/#{path}"
    end
    if !path.reverse.starts_with?("/")
      path = "#{path}/"
    end
    return path.strip
  else
    return nil
  end
end

#ensureRelativePath(path) ⇒ Object

parse for full URLs in facebook.yml (multiple people have made this mistake)



110
111
112
113
114
115
116
117
118
# File 'lib/rfacebook_on_rails/plugin/init.rb', line 110

def ensureRelativePath(path)
  if matchData = /(\w+)(\:\/\/)([\w0-9\.]+)([\:0-9]*)(.*)/.match(path)
    relativePath = matchData.captures[4]
    RAILS_DEFAULT_LOGGER.debug "** RFACEBOOK INFO: It looks like you used a full URL (#{path}) in facebook.yml.  RFacebook expected a relative path and has automatically converted this URL to #{relativePath}."
    return relativePath
  else
    return path
  end
end