Sha256: 8ba14e4fafc849c45d22b558d5955b259d35732b42fd71cb7e3ef1bae346732b

Contents?: true

Size: 682 Bytes

Versions: 4

Compression:

Stored size: 682 Bytes

Contents

# frozen_string_literal: true

module RailsWorkflow
  module User
    module Assignment
      extend ActiveSupport::Concern

      included do
        # TODO: change Operation to UserOperation
        has_many :operations, class_name: 'RailsWorkflow::Operation', as: :assignment
      end

      module ClassMethods
        def role_text(role)
          get_rassoc get_role_values, role if role.present?
        end

        def group_text(group)
          get_rassoc get_group_values, group if group.present?
        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.7.3 app/concerns/rails_workflow/user/assignment.rb
rails_workflow-0.7.2 app/concerns/rails_workflow/user/assignment.rb
rails_workflow-0.7.1 app/concerns/rails_workflow/user/assignment.rb
rails_workflow-0.7.0 app/concerns/rails_workflow/user/assignment.rb