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(directive_name, 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(directive_name, options = {}, &block)
  content = capture(&block) if block_given?

  name = Directive::Name.new(directive_name)
  input = Directive::Input.new(options.except(:html))
  html = Directive::Html.new(options[:html])

  attributes = Directive::Attributes.new([name, input, html], tag: html.tag, content: content)

  (*attributes.)
end