Skip to content

Commit

Permalink
component: allow a block in #text
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Feb 4, 2014
1 parent 3242451 commit 24ec395
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions opal/lissio/component.rb
Expand Up @@ -127,10 +127,16 @@ def self.html(string = nil, &block)
end
end

def self.text(string)
render {
element.content = string
}
def self.text(string = nil, &block)
if block
render {
element.content = instance_exec(&block)
}
else
render {
element.content = string
}
end
end

def self.css!(content = nil, &block)
Expand Down

0 comments on commit 24ec395

Please sign in to comment.