Sha256: b8ada4243325f32d31d7bff606840c51bdd304e84a4125db9ff68b95200b6869

Contents?: true

Size: 646 Bytes

Versions: 21

Compression:

Stored size: 646 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.typus_constantize
  end

  def typus_constantize
    Typus::Configuration.models_constantized[self]
  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

21 entries across 21 versions & 1 rubygems

Version Path
typus-3.0.12 lib/support/string.rb
typus-3.0.11 lib/support/string.rb
typus-3.1.0.rc12 lib/support/string.rb
typus-3.0.11.rc5 lib/support/string.rb
typus-3.1.0.rc11 lib/support/string.rb
typus-3.1.0.rc10 lib/support/string.rb
typus-3.0.11.rc4 lib/support/string.rb
typus-3.1.0.rc9 lib/support/string.rb
typus-3.0.11.rc3 lib/support/string.rb
typus-3.1.0.rc8 lib/support/string.rb
typus-3.1.0.rc7 lib/support/string.rb
typus-3.1.0.rc6 lib/support/string.rb
typus-3.1.0.rc5 lib/support/string.rb
typus-3.1.0.rc4 lib/support/string.rb
typus-3.1.0.rc3 lib/support/string.rb
typus-3.1.0.rc2 lib/support/string.rb
typus-3.0.11.rc2 lib/support/string.rb
typus-3.0.11.rc1 lib/support/string.rb
typus-3.1.0.rc1 lib/support/string.rb
typus-3.0.10 lib/support/string.rb