Sha256: 3cecd5a8b28f9445c85b47f163560d88492cdeb0ef327919aac890eefd1c88c9

Contents?: true

Size: 805 Bytes

Versions: 3

Compression:

Stored size: 805 Bytes

Contents

module ActiveList
  module Helpers

    def recordify!(value, record_name)
      if value.is_a?(Symbol)
        return record_name + "." + value.to_s
      elsif value.is_a?(Code)
        return "(" + value.gsub(/RECORD/, record_name) + ")"
      else
        raise ArgumentError, "Code or Symbol must be given to be recordified)"
      end
    end

    def recordify(value, record_name)
      if value.is_a?(Symbol)
        return record_name + "." + value.to_s
      elsif value.is_a?(Code)
        return "(" + value.gsub(/RECORD/, record_name) + ")"
      else
        return value.inspect
      end
    end

    def urlify(value, record_name)
      if value.is_a?(Code)
        return "(" + value.gsub(/RECORD/, record_name) + ")"
      else
        return value.inspect
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
active_list-6.0.0 lib/active_list/helpers.rb
active-list-5.0.1 lib/active_list/helpers.rb
active-list-5.0.0 lib/active_list/helpers.rb