module CIMIHelper

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Public Instance Methods

href_id(href, entity) click to toggle source
# File lib/cimi/helpers/cimi_helper.rb, line 23
def href_id(href, entity)
  split_on = self.send(:"#{entity.to_s}_url")
  href.split("#{split_on}/").last
end
no_content_with_status(code=200) click to toggle source
# File lib/cimi/helpers/cimi_helper.rb, line 18
def no_content_with_status(code=200)
  body ''
  status code
end
to_kibibyte(value, unit) click to toggle source
# File lib/cimi/helpers/cimi_helper.rb, line 28
def to_kibibyte(value, unit)
  case unit
    when "GB"
      value*1024*1024
    when "MB"
      value*1024
    else
      nil # should probably be exploding something here...
  end
end