Sha256: fa788b2c05bd83284780cd5d79b22f7878662ba2681a69be6f19edc6d34bd261

Contents?: true

Size: 558 Bytes

Versions: 6

Compression:

Stored size: 558 Bytes

Contents

class String

  def extract_settings
    split(",").map { |x| x.strip }
  end

  def remove_prefix
    split("/")[1..-1].join("/")
  end

  def extract_class
    remove_prefix.classify.constantize
  end

  def acl_action_mapper
    case self
    when "new", "create"
      "create"
    when "index", "show", "autocomplete"
      "read"
    when "edit", "update", "position", "toggle", "relate", "unrelate"
      "update"
    when "destroy", "trash"
      "delete"
    else
      self
    end
  end

  def to_resource
    self.underscore.pluralize
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
typus-3.1.0.rc18 lib/support/string.rb
typus-3.1.0.rc17 lib/support/string.rb
typus-3.1.0.rc16 lib/support/string.rb
typus-3.1.0.rc15 lib/support/string.rb
typus-3.1.0.rc14 lib/support/string.rb
typus-3.1.0.rc13 lib/support/string.rb