Sha256: acad28a07d326ed471503261d00bfdad77113c07409d99384c80298c46ba1ed6

Contents?: true

Size: 394 Bytes

Versions: 6

Compression:

Stored size: 394 Bytes

Contents

# Creates constants of aliases expecting a hash of existing constants mapped to their aliases.
class Alias::Creators::ConstantCreator < Alias::Creator
  map {|config| config.map {|k,v| {:name=>k, :alias=>v}} }

  valid :alias, :unless=>:constant, :optional=>true
  valid :name, :if=>:constant

  generate do |aliases|
    aliases.map {|e| "::#{e[:alias]} = ::#{e[:name]}"}.join("\n")
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
cldwalker-alias-0.2.0 lib/alias/creators/constant_creator.rb
cldwalker-alias-0.2.1 lib/alias/creators/constant_creator.rb
alias-0.2.3 lib/alias/creators/constant_creator.rb
alias-0.2.2 lib/alias/creators/constant_creator.rb
alias-0.2.0 lib/alias/creators/constant_creator.rb
alias-0.2.1 lib/alias/creators/constant_creator.rb