Class: HeyYou::Builder
- Inherits:
-
Object
- Object
- HeyYou::Builder
- Includes:
- Helper
- Defined in:
- lib/hey_you/builder.rb,
lib/hey_you/builder/push.rb,
lib/hey_you/builder/_base.rb,
lib/hey_you/builder/email.rb
Defined Under Namespace
Classes: Base, DataNotFound, Email, Push, RequiredChannelNotFound, UnknownLocale
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(key, **options) ⇒ Builder
constructor
Load data from collection yaml via key and interpolate variables.
Methods included from Helper
Constructor Details
#initialize(key, **options) ⇒ Builder
Load data from collection yaml via key and interpolate variables. Define methods for each registered channel. After initialize you can use
`instance.<ch_name>`. It will be return instance of HeyYou::Builder::<YOUR_CHANNEL_NAME>
Skip builder for excluded channels (not included in ‘only` option)
19 20 21 22 23 24 25 |
# File 'lib/hey_you/builder.rb', line 19 def initialize(key, **) @data = fetch_from_collection_by_key(key, [:locale]) @options = config.registered_channels.each do |ch| init_channel_builder(ch, key) if channel_allowed_by_only?(ch, [:only]) end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/hey_you/builder.rb', line 10 def data @data end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
10 11 12 |
# File 'lib/hey_you/builder.rb', line 10 def keys @keys end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/hey_you/builder.rb', line 10 def @options end |