Sha256: fa70bd55640283999fc540dda6bf4cc68a405a422d8d76f4c1384b0174b56422

Contents?: true

Size: 652 Bytes

Versions: 4

Compression:

Stored size: 652 Bytes

Contents

module RailsWorkflow
  module User
    module Assignment
      extend ActiveSupport::Concern

      included do
        has_many :operations, class_name: "RailsWorkflow::Operation", as: :assignment
      end

      module ClassMethods

        def role_text role
          if role.present?
            get_rassoc get_role_values, role
          end
        end

        def group_text group
          if group.present?
            get_rassoc get_group_values, group
          end
        end

        def get_rassoc values, value
          (values.rassoc(value.to_s) || values.rassoc(value.to_sym)).try(:[], 0)
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_workflow-0.3.7 app/concerns/rails_workflow/user/assignment.rb
rails_workflow-0.3.6 app/concerns/rails_workflow/user/assignment.rb
rails_workflow-0.3.5 app/concerns/rails_workflow/user/assignment.rb
rails_workflow-0.3.4 app/concerns/rails_workflow/user/assignment.rb