Class: Prestashop::Mapper::Model
- Inherits:
-
Object
- Object
- Prestashop::Mapper::Model
- Extended by:
- Extension
- Includes:
- Extension
- Defined in:
- lib/prestashop/mapper/model.rb
Direct Known Subclasses
Address, Carrier, Cart, CartRule, Category, Combination, Contact, ContentManagementSystem, Country, Currency, Customer, CustomerMessage, CustomerThread, Delivery, Employee, Group, Guest, Image, ImageType, Language, Manufacturer, Order, OrderCarrier, OrderDetail, OrderDiscount, OrderHistory, OrderInvoice, OrderPayment, OrderState, PriceRange, Product, ProductFeature, ProductFeatureValue, ProductOption, ProductOptionValue, ProductSupplier, Search, Shop, ShopGroup, SpecificPrice, SpecificPriceRule, State, Stock, StockAvailable, StockMovement, StockMovementReason, Store, Supplier, SupplyOrder, SupplyOrderDetail, SupplyOrderHistory, SupplyOrderReceiptHistory, SupplyOrderState, Tag, Tax, TaxRule, TaxRuleGroup, TranslatedConfiguration, Warehouse, WarehouseProductLocation, WeightRange, Zone
Class Method Summary collapse
Instance Method Summary collapse
- #hash_lang(name, id_lang) ⇒ Object
-
#meta_description ⇒ Object
Meta description is same as description, when is not given.
-
#meta_keywords ⇒ Object
Meta keywords are generated from name, when are not given.
-
#meta_title ⇒ Object
Meta title is same as name, when is not given.
Methods included from Extension
Class Method Details
.model(value = nil) ⇒ Object
32 33 34 |
# File 'lib/prestashop/mapper/model.rb', line 32 def model value = nil value.nil? ? @model : @model = value end |
.resource(value = nil) ⇒ Object
28 29 30 |
# File 'lib/prestashop/mapper/model.rb', line 28 def resource value = nil value.nil? ? @resource : @resource = value end |
Instance Method Details
#hash_lang(name, id_lang) ⇒ Object
23 24 25 |
# File 'lib/prestashop/mapper/model.rb', line 23 def hash_lang name, id_lang { language: { val: name, attr: { id: id_lang }}} if name end |
#meta_description ⇒ Object
Meta description is same as description, when is not given
14 15 16 |
# File 'lib/prestashop/mapper/model.rb', line 14 def @meta_description ? @meta_description.restricted.truncate(252) : ( description_short.plain if description_short ) end |
#meta_keywords ⇒ Object
Meta keywords are generated from name, when are not given
19 20 21 |
# File 'lib/prestashop/mapper/model.rb', line 19 def @meta_keywords ? @meta_keywords.plain.truncate(61) : name.split(' ').join(', ') end |
#meta_title ⇒ Object
Meta title is same as name, when is not given
9 10 11 |
# File 'lib/prestashop/mapper/model.rb', line 9 def @meta_title ? @meta_title.plain.truncate(61) : name end |