Skip to content

Commit

Permalink
component: merge with #tag and replace with #tag!
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Jan 31, 2014
1 parent e693eba commit 8237eed
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions opal/lissio/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ def self.element(name = nil)
end

def self.tag(options = nil)
return @tag unless options

@tag ||= {}

if cls = options.delete(:class)
@tag[:class] = Array(@tag[:class]).concat(Array(cls))
end

@tag.merge!(options)
end

def self.tag!(options = nil)
options ? @tag = options : @tag
end

Expand Down

0 comments on commit 8237eed

Please sign in to comment.