lib/adaptive_cards/adaptive_card.rb
def add(item)
      if item.is_a?(Action::Base)
        @actions << item
      elsif item.is_a?(String)
        @body << TextBlock.new(item)
      elsif item.is_a?(AdaptiveCards::Base) &&
            !item.is_a?(AdaptiveCards::AdaptiveCard)
        @body << item
      else
        raise InvalidContentError,
              "#{item.class} is not a valid element of an Adaptive Card"
      end
      self
    end
# Add an item (a card element, container or action) to the card
#
# @param item [AdaptiveCards::Base,string] the card element to add, or
#   a string to add in a basic text block
#
# Most items are added to the card's body, but actions will get
# automatically added to the action bar.
# As a shortcut we will also accept a string and will automatically convert
# this to a TextBlock.
Add an item (a card element, container or action) to the card
Add an item ( a card element container or action ) to the card
def add(item)
      if item.is_a?(Action::Base)
        @actions << item
      elsif item.is_a?(String)
        @body << TextBlock.new(item)
      elsif item.is_a?(AdaptiveCards::Base) &&
            !item.is_a?(AdaptiveCards::AdaptiveCard)
        @body << item
      else
        raise InvalidContentError,
              "#{item.class} is not a valid element of an Adaptive Card"
      end
      self
    end
def add ( item ) if item . is_a? ( Action :: Base ) @actions << item elsif item . is_a? ( String ) @body << TextBlock . new ( item ) elsif item . is_a? ( AdaptiveCards :: Base ) && ! item . is_a? ( AdaptiveCards :: AdaptiveCard ) @body << item else raise InvalidContentError , "#{item.class} is not a valid element of an Adaptive Card" end self end
Add an item (a card element, container or action) to the card
Add an item ( a card element container or action ) to the card
item
the card element to add, or a string to add in a basic text block Most items are added to the card's body, but actions will get automatically added to the action bar. As a shortcut we will also accept a string and will automatically convert this to a TextBlock.
the card element to add or a string to add in a basic text block Most items are added to the card ' s body but actions will get automatically added to the action bar . As a shortcut we will also accept a string and will automatically convert this to a TextBlock .