Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

components should accept any number of params to be merged #114

@sollycatprint

Description

@sollycatprint

From @catmando on January 6, 2016 23:54

for example

  div(attributes, {more: :stuff}, :big, id: "hello", style: {display: :none})

should be the same as

  div(attributes.merge {more: :stuff, big: true, id: "hello, style: {display: none})

Precisely - all args that are hashes should be merged, any non hash arg should be added to the merged hash with a value of true.

Why? because sometimes you have a ready made set of params (i.e. attributes passed to a component) and you want to merge in others.

this is how you process the attributes (i just wanted to make sure it would work)

  args.inject({}) do |h, item|
    if item.is_a? Hash 
      h.merge item
    else
      h[item] = true
      h
    end
  end

Copied from original issue: zetachang/react.rb#114

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions