Class: Jasonette::Item

Inherits:
Base
  • Object
show all
Defined in:
lib/jasonette/core/item.rb

Direct Known Subclasses

Layout, Map

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

#badge(caption = nil) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/jasonette/core/item.rb', line 6

def badge caption=nil
  item = self.class.new(context) do
    text caption unless caption.nil?
    encode(&::Proc.new) if block_given?
  end
  append item, "badge"
end