Module: AngularSprinkles::Helpers::DirectiveHelper

Included in:
AngularSprinkles::Helpers
Defined in:
lib/angular_sprinkles/helpers/directive_helper.rb

Instance Method Summary collapse

Instance Method Details

#directive(name, input = {}, options = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/angular_sprinkles/helpers/directive_helper.rb', line 4

def directive(name, input = {}, options = {}, &block)
  content = capture(&block) if block_given?

  attributes = Directive::Attributes.new([
    Directive::Name.new(name),
    Directive::Input::new(input),
    Directive::Options::new(options.except(:tag))
  ], { tag: options[:tag], content: content })

  (*attributes.)
end