Sha256: 743654bdee12693cfb7c6e27920df32b5941c5c773c1188a1f72b958f7a98420
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
module Lopata # @see Lopata::Configuration#role_descriptions # @see Lopata::Configuration#default_role module Role # To be included in Lopata::Scenario module Methods def current_role metadata[:as] end end # To be included in Lopata::ScenarioBuilder module DSL def as(*args, &block) @roles = args.flatten @roles << Lopata::ScenarioBuilder::CalculatedValue.new(&block) if block_given? @role_options = nil end def role_options @role_options ||= build_role_options end def without_user @without_user = true end def build_role_options return [] unless roles [Lopata::ScenarioBuilder::Diagonal.new(:as, roles.map { |r| [Lopata.configuration.role_descriptions[r], r] })] end def roles return false if @without_user @roles ||= [Lopata.configuration.default_role].compact end def diagonals super + role_options end end end end Lopata::Scenario.include Lopata::Role::Methods Lopata::ScenarioBuilder.prepend Lopata::Role::DSL
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lopata-0.1.6 | lib/lopata/role.rb |