0.0
No commit activity in last 3 years
No release in over 3 years
Add a basic HTML wrapper to your Ruby object. Suitable for use with a web server.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.3.0, ~> 0.3
>= 0.1.0, ~> 0.1
>= 2.3.0, ~> 2.3
 Project Readme

Interfacing with multiples apps using the apphtml_layer gem

require 'apphtml_layer'


class Fun

  def initialize(id)
    @id = id
  end

  def go()
    'go ' + @id
  end

  def hello(name)
    'hello ' + name
  end

  def food(apples: 0, grapes: 0)
    {apples: apples.to_i, grapes: grapes.to_i}
  end

  def connected?()
    true
  end

end


h = {
  fun: Fun.new('123'),
  fun2: Fun.new('456')
}
ah = AppHtmlLayer.new(h, filepath: '/home/james/tmp/fun', headings: false, debug: true)
ah.lookup '/fun/go' #=> '123'
ah.lookup '/fun2/go' #=> '456'

ah.lookup '/fun/connected?' #=> 'true'
ah.lookup '/fun/name?arg=Fred' #=> 'hello Fred'

apphttp apphtml_layer


Introducing the AppHtml_layer gem

require 'apphtml_layer'


class Fun

  def initialize()
  end

  def go()
    'go 123'
  end

  def hello(name)
    'hello ' + name
  end

  def food(apples: 0, grapes: 0)
    {apples: apples.to_i, grapes: grapes.to_i}
  end

end

ah = AppHtml.new(Fun.new, filepath: '/home/james/tmp/fun', headings: false, debug: true)
ah.lookup '/go'
#=> ["go 123", "text/plain"] 

ah.lookup '/hello/James'
#=> ["hello James", "text/plain"] 

ah.lookup '/hello?arg=James'
#=> ["hello James", "text/plain"] 

ah.lookup '/food?apples=3'
=> ['{"apples":3,"grapes":0}', "application/json"] 

The AppHtmlLayer gem makes it more convenient to prepare a working prototype or an HTML application for a web server. An HTML file can be associated with each public method and used in the output.

Resources

apphtml apphttp app webserver http apphtmllayerIntroducing the AppHtml_layer gem

require 'apphtml'


class Fun

  def initialize()
  end

  def go()
    'go 123'
  end

  def hello(name)
    'hello ' + name
  end

  def food(apples: 0, grapes: 0)
    {apples: apples.to_i, grapes: grapes.to_i}
  end

end

ah = AppHtml.new(Fun.new, filepath: '/home/james/tmp/fun', headings: false, debug: true)
ah.lookup '/go'
#=> ["go 123", "text/plain"] 

ah.lookup '/hello/James'
#=> ["hello James", "text/plain"] 

ah.lookup '/hello?arg=James'
#=> ["hello James", "text/plain"] 

ah.lookup '/food?apples=3'
=> ['{"apples":3,"grapes":0}', "application/json"] 

The AppHtmlLayer gem makes it more convenient to prepare a working prototype or an HTML application for a web server. An HTML file can be associated with each public method and used in the output.

Resources

apphtml apphttp app webserver http apphtmllayer