Sha256: 95147ec873f74d8deebce5dfe4e0ad07237463c2dcecfbadbef303eacee4dec4

Contents?: true

Size: 975 Bytes

Versions: 1

Compression:

Stored size: 975 Bytes

Contents

class Jcompiler
  @@codes = {}

  private

  attr_accessor :ids

  def b(brand, bind)
    bind.local_variable_set(:brand, brand)
    {
      id: 'brand.id',
      name: 'brand.name',
      description: 'brand.description',
      published_at: 'brand.published_at.utc.iso8601(3)',
      official_url: 'brand.blog_url',
      sex_group: 'brand.blog_sex_switch',
      image_medium: 'absolute_url(brand.image_file.url(:medium))',
      image_square: 'absolute_url(brand.image_file.url(:square))',
      url: 'brand_path(brand)',
      labels: 'brand.new_arrival? ? \'["NEW"]\' : \'[]\''
    }.map do |key, code|
      v = eval(code, bind)
      "\"#{key}\":#{v.is_a?(String) ? ActiveSupport::JSON.encode(v) : v ? v.to_s : 'null'}"
    end
  end

  def a(brands, bind)
    brands.map do |brand|
      "{#{b(brand, bind).join(',')}}"
    end
  end

  def self.code(id, source, bind)
    if @@codes.has_key?(id)
      @@codes[id] ||=
    else

    end
    debugger
    1
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jcompiler-0.1.47 lib/jcompiler.rb