Class: Jasonette::Jason::Head

Inherits:
Base
  • Object
show all
Defined in:
lib/jasonette/jason/head.rb

Defined Under Namespace

Classes: Actions, Templates

Constant Summary

Constants included from Properties

Properties::DEFAULT_IS_ARRAY, Properties::TYPES

Instance Attribute Summary

Attributes inherited from Base

#attributes, #context

Instance Method Summary collapse

Methods inherited from Base

#_method, #array!, #as_json, #attr_value, #attributes!, #empty?, #encode, #extract!, #implicit_set!, #initialize, #inline, #klass, #merge!, #method_missing, #set!, #with_attributes

Methods included from Properties

#all_instance_variable_set, #create_new_klass, #get_default_for_property, #get_ivar, #has_any_property_type?, #has_property?, included, #ivar_for_property, #klass_for_property, #merge_properties, #parent_jasonette, #parent_jasonette_set, #prop, #properties_empty?, #property_get!, #property_names, #property_sender, #property_set!, #property_variables, #set_ivar

Constructor Details

This class inherits a constructor from Jasonette::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Jasonette::Base

Instance Method Details

#action(name, *args, &block) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/jasonette/jason/head.rb', line 27

def action name, *args, &block
  if block_given?
    item = Jasonette::Action.new(context, &block)
    append item, "actions", name
  else
    property_sender actions, name, *args
  end
  self
end

#datum(name, *args, &block) ⇒ Object



19
20
21
# File 'lib/jasonette/jason/head.rb', line 19

def datum name, *args, &block
  property_sender data, name, *args, &block
end

#style(name, *args, &block) ⇒ Object



23
24
25
# File 'lib/jasonette/jason/head.rb', line 23

def style name, *args, &block
  property_sender styles, name, *args, &block
end

#template(name, *args, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/jasonette/jason/head.rb', line 9

def template name, *args, &block
  if block_given?
    item = Jasonette::Body.new(context, &block)
    append item, "templates", name
  else
    property_sender templates, name, *args
  end
  self
end