Sha256: cecd46ed6ada4653e4f029ff4f6f99c8b2b29b42dda2d377d68b4d842c48ee5c

Contents?: true

Size: 480 Bytes

Versions: 3

Compression:

Stored size: 480 Bytes

Contents

# frozen_string_literal: true

require "ostruct"

module Heya
  module Campaigns
    class Step < OpenStruct
      include GlobalID::Identification

      def self.find(id)
        campaign_name, _step_name = id.to_s.split("/")
        campaign_name.constantize.steps.find { |s| s.id == id }
      end

      def gid
        to_gid(app: "heya").to_s
      end

      def in_segment?(user)
        Heya.in_segments?(user, *campaign.__segments, segment)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heya-0.2.1 lib/heya/campaigns/step.rb
heya-0.2.0 lib/heya/campaigns/step.rb
heya-0.1.0 lib/heya/campaigns/step.rb