Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
component: remove the super monkey business
  • Loading branch information
meh committed Jan 31, 2014
1 parent 6c6f8eb commit fb2e297
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 17 deletions.
9 changes: 3 additions & 6 deletions opal/lissio/component.rb
Expand Up @@ -149,11 +149,6 @@ def self.css(&block)

attr_accessor :parent

def initialize(parent = nil)
@parent = parent
@events = Hash.new { |h, k| h[k] = [] }
end

def tag
{ name: :div }.merge(self.class.tag || {})
end
Expand Down Expand Up @@ -181,7 +176,7 @@ def element
end
}

[self.class.events, @events].each {|events|
[self.class.events, @events].compact.each {|events|
events.each {|name, blocks|
blocks.each {|selector, block|
if Symbol === block
Expand Down Expand Up @@ -216,6 +211,8 @@ def on(name, selector = nil, method = nil, &block)
end
end
else
@events ||= Hash.new { |h, k| h[k] = [] }

if block
@events[name] << [selector, block]
elsif method
Expand Down
2 changes: 0 additions & 2 deletions opal/lissio/component/alert.rb
Expand Up @@ -8,8 +8,6 @@ def self.new!(message, options = {})
attr_reader :message, :options

def initialize(message, options = {})
super()

@message = message
@options = options
end
Expand Down
4 changes: 1 addition & 3 deletions opal/lissio/component/autocomplete.rb
Expand Up @@ -58,9 +58,7 @@ def initialize(title, results, key, input, select)
end
end

def initialize(parent = nil, &block)
super(parent)

def initialize(&block)
@autocompleters = []

if block.arity.nonzero?
Expand Down
4 changes: 1 addition & 3 deletions opal/lissio/component/container.rb
Expand Up @@ -21,9 +21,7 @@ def to_a
end
end

def initialize(parent = nil, &block)
super(parent)

def initialize(&block)
if block
@content = Definer.new(&block).to_a
else
Expand Down
4 changes: 1 addition & 3 deletions opal/lissio/component/tooltip.rb
Expand Up @@ -11,9 +11,7 @@ class Tooltip < Lissio::Component

def initialize(*args, &block)
if Lissio::Component === args.first
super(args.shift)
else
super()
@parent = args.shift
end

@options = DEFAULTS.merge(args.first)
Expand Down

0 comments on commit fb2e297

Please sign in to comment.